aboutsummaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui-editors/gui-editor-apex/src')
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js13
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js35
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js16
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js20
4 files changed, 81 insertions, 3 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
index a1aed28..8bc3ed0 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2021 Nordix Foundation
+ * Copyright (C) 2020-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,4 +132,13 @@ test('Test Generate Description Pressed', () => {
const mock_activate = jest.fn(mod.editContextAlbumForm_generateDescriptionPressed);
mock_activate();
expect(mock_activate).toBeCalled();
-}); \ No newline at end of file
+});
+
+test('Test editContextAlbumForm_cancelPressed', () => {
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValue(null);
+ jest.spyOn(document, 'getElementById').mockReturnValue(null);
+ jest.spyOn(contextAlbumTab_reset, 'contextAlbumTab_reset').mockReturnValue(null);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_cancelPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
index bcf21e5..48573e8 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
@@ -44,6 +44,8 @@ const contextSchema = {
description: 'testDesc'
}
+const parentTBody = document.createElement('table');
+
test('Test Activate', () => {
const mock_activate = jest.fn(mod.editEventForm_activate);
mock_activate(null, 'CREATE', null, contextSchema);
@@ -138,6 +140,14 @@ test('Test Create Event', () => {
expect(mock_activate).toBeCalled();
});
+test('Test editEventForm_addEventParam', () => {
+ let contextSchemas = new Array();
+ contextSchemas.push(contextSchema);
+ const mock_activate = jest.fn(mod.editEventForm_addEventParam);
+ mock_activate(parentTBody, false, 'name', null, contextSchema, contextSchemas);
+ expect(mock_activate).toBeCalled();
+});
+
test('Test Edit Event Generate UUID Pressed', () => {
let documentSpy = jest.spyOn(document, 'getElementById');
let elementMock = document.createElement("editContextSchemaFormDescriptionTextArea");
@@ -156,3 +166,28 @@ test('Test Edit Event Generate Description Pressed', () => {
mock_activate();
expect(mock_activate).toBeCalled();
});
+test('Test editEventForm_cancelPressed', () => {
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(eventTab_reset, 'eventTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editEventForm_cancelPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test editTaskForm_submitPressed', () => {
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(eventTab_reset, 'eventTab_reset').mockReturnValueOnce(null);
+
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editEventForm");
+ elementMock.setAttribute("createEditOrView", "CREATE");
+ elementMock.value = 'name_version'
+ elementMock.rows = 2
+ documentSpy.mockReturnValue(elementMock);
+
+ const mock_activate = jest.fn(mod.editEventForm_submitPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
index f7ac592..b9982f5 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTaskEditForm.test.js
@@ -161,3 +161,19 @@ test('Test editTaskForm_cancelPressed', () => {
mock_activate();
expect(mock_activate).toBeCalled();
});
+
+test('Test editTaskForm_submitPressed', () => {
+ jest.spyOn(apexTaskTab, 'taskTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editTaskForm");
+ elementMock.setAttribute("createEditOrView", "CREATE");
+ elementMock.value = 'logictype'
+ documentSpy.mockReturnValue(elementMock);
+
+ const mock_activate = jest.fn(mod.editTaskForm_submitPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
index bc331b6..ba4a536 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUtils.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,3 +96,21 @@ test('createAddFormButton with text', () => {
const actual = ApexUtils.createAddFormButton('My_text');
expect(actual).toEqual(expected);
});
+
+test('test EMPTY createEditArea', () => {
+ const mock_activate = jest.fn(ApexUtils.createEditArea);
+ mock_activate('id', null, '');
+ expect(mock_activate).toBeCalled();
+});
+
+test('test getHomepageURL', () => {
+ const mock_activate = jest.fn(ApexUtils.getHomepageURL);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('test isFirefox', () => {
+ const mock_activate = jest.fn(ApexUtils.isFirefox);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+}); \ No newline at end of file