diff options
author | 2021-06-15 11:53:55 +0100 | |
---|---|---|
committer | 2021-06-15 11:53:55 +0100 | |
commit | 0f47b6cd44b11138d390fcc8c431738a5622a539 (patch) | |
tree | 168d15d678603f0cd927c3b10ad9658124c29335 /gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js | |
parent | 8c6beedc3d58420988c9e80d75aad96198e2962e (diff) |
Increase code coverage on gui
- increase code coverage on gui js
Issue-ID: POLICY-3351
Signed-off-by: arkadiusz.adamski <aadamski@est.tech>
Change-Id: I5c24e6f02c401fd1eaee819105673cfcf1c81e13
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js index 504f84f..894d668 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexTable.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation + * Copyright (C) 2020-2021 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,21 +17,27 @@ * ============LICENSE_END========================================================= */ -const mod = require('../ApexTable'); +const ApexTable = require("../ApexTable") -let wrapper = document.createElement("example"); -wrapper.setAttribute("id", "engineSummary_wrapper"); -wrapper.setAttribute("class", "wrapper_borderless"); +test("Test createTable", () => { + const expected = document.createElement("table"); + expected.id = "my-id"; + expected.className = "apexTable ebTable elTablelib-Table-table ebTable_striped"; -test('call createTable', () => { - const createTable = mod.createTable('01'); - expect(createTable.getAttribute('id')).toBeDefined(); - expect(createTable.getAttribute('class')).toBeDefined(); - expect(createTable.getAttribute('id').valueOf()).toBe('01'); + const actual = ApexTable.createTable(expected.id); + expect(actual).toEqual(actual); }); -test('test setRowHover', () => { - const mock = jest.fn(mod.setRowHover(wrapper)); - mock(); - expect(mock).toBeCalledTimes(1); -})
\ No newline at end of file +test("Test setRowHover", () => { + const element = { + className: null, + onmouseover: null, + onmouseout: null + }; + + ApexTable.setRowHover(element); + + expect(element.className).toBe("ebTableRow"); + expect(typeof element.onmouseover).toBe("function"); + expect(typeof element.onmouseout).toBe("function"); +}); |