Skip to content

Commit

Permalink
Merge pull request twbs#2 from lucascono/v4-dev-modal-unit-test
Browse files Browse the repository at this point in the history
Unit test for modal bug fix
  • Loading branch information
lucascono authored Oct 4, 2017
2 parents d8d1326 + 47968c8 commit 2729d81
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions js/tests/unit/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})

0 comments on commit 2729d81

Please sign in to comment.