mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-28 20:52:21 +01:00
Merge branch 'v4-dev-18796' of https://github.com/maxbeatty/bootstrap into maxbeatty-v4-dev-18796
This commit is contained in:
commit
25d218b02d
@ -489,7 +489,7 @@ const Modal = (($) => {
|
|||||||
const config = $(target).data(DATA_KEY) ?
|
const config = $(target).data(DATA_KEY) ?
|
||||||
'toggle' : $.extend({}, $(target).data(), $(this).data())
|
'toggle' : $.extend({}, $(target).data(), $(this).data())
|
||||||
|
|
||||||
if (this.tagName === 'A') {
|
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,4 +454,26 @@ $(function () {
|
|||||||
})
|
})
|
||||||
.bootstrapModal('show')
|
.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')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user