aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-11-26 01:04:51 -0800
committerMark Otto <[email protected]>2016-11-26 01:04:51 -0800
commitabbc2b7c93ed36aa5ff4b92ae78cd7d87b758cc7 (patch)
tree0785fc9094a2e3dc8b242109ccca31b3092d768e /js/tests
parentd82d04fd6df5b62bf4b0a4cf8a590bbd4a52fdba (diff)
parentbb6c197d9baeb873ad6aeb4af51632c85187d133 (diff)
downloadbootstrap-abbc2b7c93ed36aa5ff4b92ae78cd7d87b758cc7.tar.xz
bootstrap-abbc2b7c93ed36aa5ff4b92ae78cd7d87b758cc7.zip
Merge branch 'v4-dev' into modal-sizes
Diffstat (limited to 'js/tests')
-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 cd3c96b9e..7af5aeb27 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -454,4 +454,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')
+ })
})