aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/modal.js
diff options
context:
space:
mode:
authorMax Beatty <[email protected]>2016-08-04 13:47:30 -0700
committerMax Beatty <[email protected]>2016-08-04 13:47:30 -0700
commitbfa714ae1e91e2f77017d02489cbc39fada032c7 (patch)
tree31edfbff98d978a9546ea740e5c0992d263c8692 /js/tests/unit/modal.js
parent0416f761dddae04a1b4d3ce70afece518330ca4d (diff)
downloadbootstrap-bfa714ae1e91e2f77017d02489cbc39fada032c7.tar.xz
bootstrap-bfa714ae1e91e2f77017d02489cbc39fada032c7.zip
prevent navigating to area href when modal target. fixes #18796
Diffstat (limited to 'js/tests/unit/modal.js')
-rw-r--r--js/tests/unit/modal.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 28c1e0ec7..7329776ba 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -403,4 +403,26 @@ $(function () {
})
.bootstrapModal('show')
})
+
+ QUnit.test('should not follow link in area tag', function (assert) {
+ assert.expect(2)
+ var done = assert.async()
+
+ $('<map><area id="test" shape="default" data-toggle="modal" data-target="#modal-test" href="demo.html"/></map>')
+ .appendTo('#qunit-fixture')
+
+ $('<div id="modal-test"><div class="contents"><div id="close" data-dismiss="modal"/></div></div>')
+ .appendTo('#qunit-fixture')
+
+ $('#test')
+ .on('click.bs.modal.data-api', function (event) {
+ assert.notOk(event.isDefaultPrevented(), 'navigating to href will happen')
+
+ setTimeout(function () {
+ assert.ok(event.isDefaultPrevented(), 'model shown instead of navigating to href')
+ done()
+ }, 1)
+ })
+ .trigger('click')
+ })
})