1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-09 07:06:36 +02:00

allow prevent default for show and hide event in modal

This commit is contained in:
Jacob Thornton
2012-03-24 17:50:21 -07:00
parent f9f03d8976
commit ef5ac02b69
4 changed files with 53 additions and 14 deletions

View File

@@ -29,6 +29,35 @@ $(function () {
.modal("show")
})
test("should fire show event", function () {
stop()
$.support.transition = false
$("<div id='modal-test'></div>")
.bind("show", function () {
ok(true, "show was called")
})
.bind("shown", function () {
$(this).remove()
start()
})
.modal("show")
})
test("should not fire shown when default prevented", function () {
stop()
$.support.transition = false
$("<div id='modal-test'></div>")
.bind("show", function (e) {
e.preventDefault()
ok(true, "show was called")
start()
})
.bind("shown", function () {
ok(false, "shown was called")
})
.modal("show")
})
test("should hide modal when hide is called", function () {
stop()
$.support.transition = false