aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/offcanvas.spec.js
diff options
context:
space:
mode:
authorBen Lertlumprasertkul <[email protected]>2021-05-11 06:45:57 +0100
committerGitHub <[email protected]>2021-05-11 08:45:57 +0300
commit052def456845c2147e4e6c99d17bba12fcbee34c (patch)
tree9f23d9f09941c43fd519bde2498da808a8764635 /js/tests/unit/offcanvas.spec.js
parent9c3ab6557ec89ae11cc27da1b4680b3e69381edf (diff)
downloadbootstrap-052def456845c2147e4e6c99d17bba12fcbee34c.tar.xz
bootstrap-052def456845c2147e4e6c99d17bba12fcbee34c.zip
Remove potential false positive assertions (#33288)
* Remove potential false positive assertions querySelector() returns null but expect(document.querySelector('...')).toBeDefined() tests that the value is not undefined * Migrated assertions from .toBeDefined() to .not.toBeNull() for .getInstance() calls in tests * Migrate offcanvas assertions from .toBeDefined() to .not.toBeNull() for .getInstance() call * convert more cases to not.toBeNull assertions Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/tests/unit/offcanvas.spec.js')
-rw-r--r--js/tests/unit/offcanvas.spec.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js
index 30edc2913..64c565318 100644
--- a/js/tests/unit/offcanvas.spec.js
+++ b/js/tests/unit/offcanvas.spec.js
@@ -560,7 +560,7 @@ describe('Offcanvas', () => {
jQueryMock.fn.offcanvas.call(jQueryMock)
- expect(Offcanvas.getInstance(div)).toBeDefined()
+ expect(Offcanvas.getInstance(div)).not.toBeNull()
})
it('should not re create an offcanvas', () => {
@@ -678,7 +678,7 @@ describe('Offcanvas', () => {
expect(Offcanvas.prototype.constructor).not.toHaveBeenCalledWith(div, { scroll: true })
const offcanvas = Offcanvas.getInstance(div)
- expect(offcanvas).toBeDefined()
+ expect(offcanvas).not.toBeNull()
expect(offcanvas._config.scroll).toBe(true)
})
})
@@ -699,7 +699,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
- expect(Offcanvas.getInstance(div)).toEqual(null)
+ expect(Offcanvas.getInstance(div)).toBeNull()
})
})
})