aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorlucascono <[email protected]>2017-10-04 08:55:40 -0300
committerlucascono <[email protected]>2017-10-04 08:55:40 -0300
commit47968c8126027c079e9a54c71a63b5dfaf3c0bda (patch)
tree6ec920700315b3ade86fb6da062224ce922ed09a /js
parentcc2f5f71aedefce01e6c977661af7dc9840a8397 (diff)
downloadbootstrap-47968c8126027c079e9a54c71a63b5dfaf3c0bda.tar.xz
bootstrap-47968c8126027c079e9a54c71a63b5dfaf3c0bda.zip
Unit test for modal bug fix
Unit test for pull request #24240
Diffstat (limited to 'js')
-rw-r--r--js/tests/unit/modal.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index e026cd7f1..d55a552ad 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -673,4 +673,17 @@ $(function () {
$toggleBtn.trigger('click')
setTimeout(done, 500)
})
+
+ QUnit.test('should not try to open a modal which is already visible', function (assert) {
+ assert.expect(1)
+ var done = assert.async()
+ var count = 0
+
+ $('<div id="modal-test"/>').on('shown.bs.modal', function () {
+ count++
+ }).on('hidden.bs.modal', function () {
+ assert.strictEqual(count, 1, 'show() runs only once')
+ done()
+ }).bootstrapModal('show').bootstrapModal('show').bootstrapModal('hide')
+ })
})