aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-10-30 16:42:42 +0100
committerJohann-S <[email protected]>2018-10-30 16:59:24 +0100
commitcebdfb909006c0593e1de5fad61b2f9dc763c61c (patch)
treeb3546f4f165d79c19534b9eec9ea852d9b8e3c43
parentbd2851938a5a5764adac008613825fb2daca0326 (diff)
downloadbootstrap-cebdfb909006c0593e1de5fad61b2f9dc763c61c.tar.xz
bootstrap-cebdfb909006c0593e1de5fad61b2f9dc763c61c.zip
fix dispose modal unit test
-rw-r--r--js/tests/unit/modal.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 4c857105b..1156ce0c7 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -717,14 +717,19 @@ $(function () {
$(this).bootstrapModal('dispose')
- const modalDataApiEvent = $._data(document, 'events').click
- .find((e) => e.namespace === 'bs.data-api.modal')
+ var modalDataApiEvent = []
+ $._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(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()
done()