diff options
| author | Jacob Thornton <[email protected]> | 2012-03-24 17:50:21 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2012-03-24 17:50:21 -0700 |
| commit | ef5ac02b698ffab3a42d21f20859b70df85543c0 (patch) | |
| tree | 89b3a3abba746b0d81e05f46e6045b64700f5819 /js/tests | |
| parent | f9f03d8976710b8aa10abd5f89c0a699758ff0a0 (diff) | |
| download | bootstrap-ef5ac02b698ffab3a42d21f20859b70df85543c0.tar.xz bootstrap-ef5ac02b698ffab3a42d21f20859b70df85543c0.zip | |
allow prevent default for show and hide event in modal
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/bootstrap-modal.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/bootstrap-modal.js index 22f5781ea..0851f64a7 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 |
