mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +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
@@ -134,7 +134,7 @@ describe('Alert', () => {
|
||||
const alertEl = document.querySelector('.alert')
|
||||
const alert = new Alert(alertEl)
|
||||
|
||||
expect(Alert.getInstance(alertEl)).toBeDefined()
|
||||
expect(Alert.getInstance(alertEl)).not.toBeNull()
|
||||
|
||||
alert.dispose()
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('Alert', () => {
|
||||
|
||||
jQueryMock.fn.alert.call(jQueryMock, 'close')
|
||||
|
||||
expect(Alert.getInstance(alertEl)).toBeDefined()
|
||||
expect(Alert.getInstance(alertEl)).not.toBeNull()
|
||||
expect(fixtureEl.querySelector('.alert')).toBeNull()
|
||||
})
|
||||
|
||||
@@ -183,7 +183,7 @@ describe('Alert', () => {
|
||||
|
||||
jQueryMock.fn.alert.call(jQueryMock)
|
||||
|
||||
expect(Alert.getInstance(alertEl)).toBeDefined()
|
||||
expect(Alert.getInstance(alertEl)).not.toBeNull()
|
||||
expect(fixtureEl.querySelector('.alert')).not.toBeNull()
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user