mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 21:09:06 +02:00
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 <xhmikosr@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9c3ab6557e
commit
052def4568
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user