mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 07:06:36 +02:00
tests: replace 'done' callback with 'Promise' to fix deprecation errors (#35659)
Reference: https://jasmine.github.io/tutorials/async 'DEPRECATION: An asynchronous function called its 'done' callback more than once. This is a bug in the spec, beforeAll, beforeEach, afterAll, or afterEach function in question. This will be treated as an error in a future version. See<https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#deprecations-due-to-calling-done-multiple-times> for more information.
This commit is contained in:
@@ -12,7 +12,7 @@ import ScrollSpy from '../../src/scrollspy'
|
||||
import Tab from '../../src/tab'
|
||||
import Toast from '../../src/toast'
|
||||
import Tooltip from '../../src/tooltip'
|
||||
import { getFixture, clearFixture } from '../helpers/fixture'
|
||||
import { clearFixture, getFixture } from '../helpers/fixture'
|
||||
|
||||
describe('jQuery', () => {
|
||||
let fixtureEl
|
||||
@@ -40,19 +40,21 @@ describe('jQuery', () => {
|
||||
expect(Tooltip.jQueryInterface).toEqual(jQuery.fn.tooltip)
|
||||
})
|
||||
|
||||
it('should use jQuery event system', done => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="alert">',
|
||||
' <button type="button" data-bs-dismiss="alert">x</button>',
|
||||
'</div>'
|
||||
].join('')
|
||||
it('should use jQuery event system', () => {
|
||||
return new Promise(resolve => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="alert">',
|
||||
' <button type="button" data-bs-dismiss="alert">x</button>',
|
||||
'</div>'
|
||||
].join('')
|
||||
|
||||
$(fixtureEl).find('.alert')
|
||||
.one('closed.bs.alert', () => {
|
||||
expect($(fixtureEl).find('.alert')).toHaveSize(0)
|
||||
done()
|
||||
})
|
||||
$(fixtureEl).find('.alert')
|
||||
.one('closed.bs.alert', () => {
|
||||
expect($(fixtureEl).find('.alert')).toHaveSize(0)
|
||||
resolve()
|
||||
})
|
||||
|
||||
$(fixtureEl).find('button').trigger('click')
|
||||
$(fixtureEl).find('button').trigger('click')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user