mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
tests: tweak Jasmine usage (#32046)
* jasmine/expect-matcher * jasmine/prefer-jasmine-matcher Found with `eslint-plugin-jasmine`
This commit is contained in:
parent
e2697b0573
commit
c9f8fa45fb
@ -297,31 +297,31 @@ describe('EventHandler', () => {
|
|||||||
EventHandler.trigger(subelement, 'click')
|
EventHandler.trigger(subelement, 'click')
|
||||||
|
|
||||||
// first listeners called
|
// first listeners called
|
||||||
expect(i === 2).toEqual(true)
|
expect(i).toEqual(2)
|
||||||
|
|
||||||
EventHandler.off(element, 'click', 'span', handler)
|
EventHandler.off(element, 'click', 'span', handler)
|
||||||
EventHandler.trigger(subelement, 'click')
|
EventHandler.trigger(subelement, 'click')
|
||||||
|
|
||||||
// removed listener not called
|
// removed listener not called
|
||||||
expect(i === 2).toEqual(true)
|
expect(i).toEqual(2)
|
||||||
|
|
||||||
EventHandler.trigger(anchor, 'click')
|
EventHandler.trigger(anchor, 'click')
|
||||||
|
|
||||||
// not removed listener called
|
// not removed listener called
|
||||||
expect(i === 3).toEqual(true)
|
expect(i).toEqual(3)
|
||||||
|
|
||||||
EventHandler.on(element, 'click', 'span', handler)
|
EventHandler.on(element, 'click', 'span', handler)
|
||||||
EventHandler.trigger(anchor, 'click')
|
EventHandler.trigger(anchor, 'click')
|
||||||
EventHandler.trigger(subelement, 'click')
|
EventHandler.trigger(subelement, 'click')
|
||||||
|
|
||||||
// listener re-registered
|
// listener re-registered
|
||||||
expect(i === 5).toEqual(true)
|
expect(i).toEqual(5)
|
||||||
|
|
||||||
EventHandler.off(element, 'click', 'span')
|
EventHandler.off(element, 'click', 'span')
|
||||||
EventHandler.trigger(subelement, 'click')
|
EventHandler.trigger(subelement, 'click')
|
||||||
|
|
||||||
// listener removed again
|
// listener removed again
|
||||||
expect(i === 5).toEqual(true)
|
expect(i).toEqual(5)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -56,7 +56,7 @@ describe('Manipulator', () => {
|
|||||||
|
|
||||||
describe('getDataAttributes', () => {
|
describe('getDataAttributes', () => {
|
||||||
it('should return empty object for null', () => {
|
it('should return empty object for null', () => {
|
||||||
expect(Manipulator.getDataAttributes(null), {})
|
expect(Manipulator.getDataAttributes(null)).toEqual({})
|
||||||
expect().nothing()
|
expect().nothing()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1320,8 +1320,8 @@ describe('Dropdown', () => {
|
|||||||
triggerDropdown.dispatchEvent(keydown)
|
triggerDropdown.dispatchEvent(keydown)
|
||||||
|
|
||||||
expect(document.activeElement.classList.contains('d-none')).toEqual(false, '.d-none not focused')
|
expect(document.activeElement.classList.contains('d-none')).toEqual(false, '.d-none not focused')
|
||||||
expect(document.activeElement.style.display === 'none').toEqual(false, '"display: none" not focused')
|
expect(document.activeElement.style.display).not.toBe('none', '"display: none" not focused')
|
||||||
expect(document.activeElement.style.visibility === 'hidden').toEqual(false, '"visibility: hidden" not focused')
|
expect(document.activeElement.style.visibility).not.toBe('hidden', '"visibility: hidden" not focused')
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -637,7 +637,7 @@ describe('Modal', () => {
|
|||||||
modalEl.addEventListener('shown.bs.modal', () => {
|
modalEl.addEventListener('shown.bs.modal', () => {
|
||||||
modalEl.click()
|
modalEl.click()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
expect(modalEl.clientHeight === modalEl.scrollHeight).toEqual(true)
|
expect(modalEl.clientHeight).toEqual(modalEl.scrollHeight)
|
||||||
done()
|
done()
|
||||||
}, 20)
|
}, 20)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user