mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-10 23:54:08 +02:00
tests: tweak Jasmine's matchers usage
Use: * toBeNull * toEqual * toBeTrue * toBeFalse * toHaveSize * toHaveClass
This commit is contained in:
@@ -25,7 +25,7 @@ describe('Alert', () => {
|
||||
})
|
||||
|
||||
it('should return version', () => {
|
||||
expect(typeof Alert.VERSION).toEqual('string')
|
||||
expect(Alert.VERSION).toEqual(jasmine.any(String))
|
||||
})
|
||||
|
||||
describe('DATA_KEY', () => {
|
||||
@@ -45,7 +45,7 @@ describe('Alert', () => {
|
||||
const button = document.querySelector('button')
|
||||
|
||||
button.click()
|
||||
expect(document.querySelectorAll('.alert').length).toEqual(0)
|
||||
expect(document.querySelectorAll('.alert')).toHaveSize(0)
|
||||
})
|
||||
|
||||
it('should close an alert without instantiating it manually with the parent selector', () => {
|
||||
@@ -58,7 +58,7 @@ describe('Alert', () => {
|
||||
const button = document.querySelector('button')
|
||||
|
||||
button.click()
|
||||
expect(document.querySelectorAll('.alert').length).toEqual(0)
|
||||
expect(document.querySelectorAll('.alert')).toHaveSize(0)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -71,7 +71,7 @@ describe('Alert', () => {
|
||||
const alert = new Alert(alertEl)
|
||||
|
||||
alertEl.addEventListener('closed.bs.alert', () => {
|
||||
expect(document.querySelectorAll('.alert').length).toEqual(0)
|
||||
expect(document.querySelectorAll('.alert')).toHaveSize(0)
|
||||
expect(spy).not.toHaveBeenCalled()
|
||||
done()
|
||||
})
|
||||
@@ -90,7 +90,7 @@ describe('Alert', () => {
|
||||
})
|
||||
|
||||
alertEl.addEventListener('closed.bs.alert', () => {
|
||||
expect(document.querySelectorAll('.alert').length).toEqual(0)
|
||||
expect(document.querySelectorAll('.alert')).toHaveSize(0)
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -225,7 +225,7 @@ describe('Alert', () => {
|
||||
|
||||
const div = fixtureEl.querySelector('div')
|
||||
|
||||
expect(Alert.getInstance(div)).toEqual(null)
|
||||
expect(Alert.getInstance(div)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -246,7 +246,7 @@ describe('Alert', () => {
|
||||
|
||||
const div = fixtureEl.querySelector('div')
|
||||
|
||||
expect(Alert.getInstance(div)).toEqual(null)
|
||||
expect(Alert.getInstance(div)).toBeNull()
|
||||
expect(Alert.getOrCreateInstance(div)).toBeInstanceOf(Alert)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user