diff options
| author | XhmikosR <[email protected]> | 2021-09-11 21:56:28 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2021-09-28 19:09:04 +0300 |
| commit | a74f33c40649711293a009ada8b7c21330a999a5 (patch) | |
| tree | bc0135f3bcfd45ed9a0a140038cd077e8e3c2317 /js/tests | |
| parent | a82d31f4329c4dd8fabf258d807917dfed4dcca1 (diff) | |
| download | bootstrap-main-xmr-js-wip.tar.xz bootstrap-main-xmr-js-wip.zip | |
Prefer using function expressionsmain-xmr-js-wip
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/collapse.spec.js | 8 | ||||
| -rw-r--r-- | js/tests/unit/scrollspy.spec.js | 2 | ||||
| -rw-r--r-- | js/tests/unit/util/index.spec.js | 4 | ||||
| -rw-r--r-- | js/tests/unit/util/sanitizer.spec.js | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/js/tests/unit/collapse.spec.js b/js/tests/unit/collapse.spec.js index da709bb85..082e6505f 100644 --- a/js/tests/unit/collapse.spec.js +++ b/js/tests/unit/collapse.spec.js @@ -734,7 +734,7 @@ describe('Collapse', () => { two: false } - function firstTest() { + const firstTest = () => { expect(collapseOneOne.classList.contains('show')).toEqual(true) expect(collapseOneTwo.classList.contains('show')).toEqual(true) @@ -744,7 +744,7 @@ describe('Collapse', () => { triggerTwo.click() } - function secondTest() { + const secondTest = () => { expect(collapseOneOne.classList.contains('show')).toEqual(false) expect(collapseOneTwo.classList.contains('show')).toEqual(false) @@ -816,7 +816,7 @@ describe('Collapse', () => { const collapseTwo = fixtureEl.querySelector('#collapseTwo') const nestedCollapseOne = fixtureEl.querySelector('#nestedCollapseOne') - function handlerCollapseOne() { + const handlerCollapseOne = () => { expect(collapseOne.classList.contains('show')).toEqual(true) expect(collapseTwo.classList.contains('show')).toEqual(false) expect(nestedCollapseOne.classList.contains('show')).toEqual(false) @@ -826,7 +826,7 @@ describe('Collapse', () => { collapseOne.removeEventListener('shown.bs.collapse', handlerCollapseOne) } - function handlerNestedCollapseOne() { + const handlerNestedCollapseOne = () => { expect(collapseOne.classList.contains('show')).toEqual(true) expect(collapseTwo.classList.contains('show')).toEqual(false) expect(nestedCollapseOne.classList.contains('show')).toEqual(true) diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js index ad44d5b3c..66e4cd7bf 100644 --- a/js/tests/unit/scrollspy.spec.js +++ b/js/tests/unit/scrollspy.spec.js @@ -15,7 +15,7 @@ describe('ScrollSpy', () => { const paddingTop = 5 const scrollHeight = Math.ceil(contentEl.scrollTop + Manipulator.position(target).top) + paddingTop - function listener() { + const listener = () => { expect(element.classList.contains('active')).toEqual(true) contentEl.removeEventListener('scroll', listener) expect(scrollSpy._process).toHaveBeenCalled() diff --git a/js/tests/unit/util/index.spec.js b/js/tests/unit/util/index.spec.js index 38e94dc6b..2563aad8f 100644 --- a/js/tests/unit/util/index.spec.js +++ b/js/tests/unit/util/index.spec.js @@ -625,9 +625,9 @@ describe('Util', () => { }) it('should define a plugin on the jQuery instance', () => { - const pluginMock = function () {} + const pluginMock = () => {} pluginMock.NAME = 'test' - pluginMock.jQueryInterface = function () {} + pluginMock.jQueryInterface = () => {} Util.defineJQueryPlugin(pluginMock) expect(fakejQuery.fn.test).toBe(pluginMock.jQueryInterface) diff --git a/js/tests/unit/util/sanitizer.spec.js b/js/tests/unit/util/sanitizer.spec.js index 7379d221f..6aa307f72 100644 --- a/js/tests/unit/util/sanitizer.spec.js +++ b/js/tests/unit/util/sanitizer.spec.js @@ -55,6 +55,7 @@ describe('Sanitizer', () => { '</div>' ].join('') + // eslint-disable-next-line func-style function mySanitize(htmlUnsafe) { return htmlUnsafe } |
