diff options
author | 2022-02-18 12:56:12 +0000 | |
---|---|---|
committer | 2022-02-18 15:34:45 +0000 | |
commit | 6e3d850c1b6efda12a70a111c8734972c99e3db5 (patch) | |
tree | 3e620fdfc9596e27138772dac1ac3254db0cc8fb /gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js | |
parent | 85a7f17ecb252615725a86353932f9f21951adc9 (diff) |
Code Coverage policy gui Edit Forms
Issue-ID: POLICY-3351
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Change-Id: Ifea662ee9575dd73c738dd6a93998af0a19d6599
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js index b9982f5..e9fcc9b 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js @@ -177,3 +177,32 @@ test('Test editTaskForm_submitPressed', () => { mock_activate(); expect(mock_activate).toBeCalled(); }); + +test('Test editTaskForm_submitPressed with page', () => { + const jqXHR = { status: 200, responseText: "" }; + $.ajax = jest.fn().mockImplementation((args) => { + args.success(data, null, jqXHR); + }); + jest.spyOn(apexTaskTab, 'taskTab_reset').mockReturnValueOnce(null); + jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null); + jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null); + + document.documentElement.innerHTML = '<html><head></head><body>' + + '<table id="editTaskFormInputFieldsTable" value="v0">' + + '<tr class="table" inputfield_id="a1" outputfield_id="b1" param_id="c1" context_id="d1" value="v1"><td>cell1</td><td>cell2</td></tr>' + + '<tr class="table" inputfield_id="a2" outputfield_id="b2" param_id="c2" context_id="d2" value="v2"><td>cell3</td><td>cell4</td></tr>' + + '<tr class="table" inputfield_id="a3" outputfield_id="b3" param_id="c3" context_id="d3" value="v3"><td>cell5</td><td>cell6</td></tr>' + + '</table>' + + '</body></html>'; + let documentSpy = jest.spyOn(document, 'getElementById'); + let elementMock = document.getElementById("editTaskFormInputFieldsTable"); + elementMock.value = 'notNullValue'; + elementMock.selectedOption = {"name": "name1", "version": "version1"}; + elementMock.checked = {"name": "nameOpt", "version": "versionOpt"}; + elementMock.setAttribute("createEditOrView", "EDIT") + documentSpy.mockReturnValue(elementMock); + + const mock_activate = jest.fn(mod.editTaskForm_submitPressed); + mock_activate(); + expect(mock_activate).toBeCalled(); +}); |