Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-03-25 04:50:21 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-03-25 04:50:21 +0400
commitef5ac02b698ffab3a42d21f20859b70df85543c0 (patch)
tree89b3a3abba746b0d81e05f46e6045b64700f5819 /js/tests/unit/bootstrap-modal.js
parentf9f03d8976710b8aa10abd5f89c0a699758ff0a0 (diff)
allow prevent default for show and hide event in modal
Diffstat (limited to 'js/tests/unit/bootstrap-modal.js')
-rw-r--r--js/tests/unit/bootstrap-modal.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/bootstrap-modal.js
index 22f5781ea6..0851f64a72 100644
--- a/js/tests/unit/bootstrap-modal.js
+++ b/js/tests/unit/bootstrap-modal.js
@@ -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