mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 08:34:08 +02:00
fix dispose modal unit test
This commit is contained in:
@@ -717,14 +717,19 @@ $(function () {
|
|||||||
|
|
||||||
$(this).bootstrapModal('dispose')
|
$(this).bootstrapModal('dispose')
|
||||||
|
|
||||||
const modalDataApiEvent = $._data(document, 'events').click
|
var modalDataApiEvent = []
|
||||||
.find((e) => e.namespace === 'bs.data-api.modal')
|
$._data(document, 'events').click
|
||||||
|
.forEach(function (e) {
|
||||||
|
if (e.namespace === 'bs.data-api.modal') {
|
||||||
|
modalDataApiEvent.push(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
assert.ok(typeof $(this).data('bs.modal') === 'undefined', 'modal data object was disposed')
|
assert.ok(typeof $(this).data('bs.modal') === 'undefined', 'modal data object was disposed')
|
||||||
|
|
||||||
assert.ok(spy.callCount === 4, '`jQuery.off` was called')
|
assert.ok(spy.callCount === 4, '`jQuery.off` was called')
|
||||||
|
|
||||||
assert.ok(typeof modalDataApiEvent !== 'undefined', '`Event.CLICK_DATA_API` on `document` was not removed')
|
assert.ok(modalDataApiEvent.length === 1, '`Event.CLICK_DATA_API` on `document` was not removed')
|
||||||
|
|
||||||
$.fn.off.restore()
|
$.fn.off.restore()
|
||||||
done()
|
done()
|
||||||
|
Reference in New Issue
Block a user