]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Unit test for modal bug fix
authorlucascono <lucasconobanegas@gmail.com>
Wed, 4 Oct 2017 11:55:40 +0000 (08:55 -0300)
committerlucascono <lucasconobanegas@gmail.com>
Wed, 4 Oct 2017 11:55:40 +0000 (08:55 -0300)
Unit test for pull request #24240

js/tests/unit/modal.js

index e026cd7f148ca109eac383452001e409cd54758a..d55a552ade4549d5a1a38e1d830145cc78db020c 100644 (file)
@@ -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')
+  })
 })