0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

tests: tweak Jasmine usage (#32046)

* jasmine/expect-matcher
* jasmine/prefer-jasmine-matcher

Found with `eslint-plugin-jasmine`
This commit is contained in:
XhmikosR 2020-11-02 16:13:24 +02:00 committed by GitHub
parent e2697b0573
commit c9f8fa45fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -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)
}) })
}) })
}) })

View File

@ -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()
}) })

View File

@ -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()
}) })

View File

@ -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)
}) })