summaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js')
-rw-r--r--gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js
index 8bc3ed0..8d2976d 100644
--- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js
@@ -136,9 +136,35 @@ test('Test Generate Description Pressed', () => {
test('Test editContextAlbumForm_cancelPressed', () => {
jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValue(null);
- jest.spyOn(document, 'getElementById').mockReturnValue(null);
+ const mock = 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();
+ mock.mockRestore();
});
+
+test('Test Submit Pressed with page', () => {
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValue(null);
+ jest.spyOn(contextAlbumTab_reset, 'contextAlbumTab_reset').mockReturnValueOnce(null);
+
+ document.documentElement.innerHTML = '<html><head></head><body>' +
+ '<div id="editContextAlbumFormDiv"></div>' +
+ '</body></html>';
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.getElementById("editContextAlbumFormDiv");
+ elementMock.value = 'APPLICATION';
+ elementMock.selectedOption = {"name": "schemaName", "version": "schemaVers"};
+ elementMock.checked = false;
+ elementMock.setAttribute("createEditOrView", "CREATE");
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_submitPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+}); \ No newline at end of file