aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfat <[email protected]>2013-08-17 14:24:38 -0700
committerfat <[email protected]>2013-08-17 14:24:38 -0700
commit712b89ed4ebe71e44f2a7081be7ba372d8ca3f42 (patch)
treef0a86f3d11841bedee5f120263b1d3c9cdd1e547
parent728a5e17d667422cdad791e06375e8e9a0f80cc1 (diff)
downloadbootstrap-712b89ed4ebe71e44f2a7081be7ba372d8ca3f42.tar.xz
bootstrap-712b89ed4ebe71e44f2a7081be7ba372d8ca3f42.zip
fixes #9362
-rw-r--r--js/modal.js4
-rw-r--r--js/tests/unit/modal.js19
2 files changed, 22 insertions, 1 deletions
diff --git a/js/modal.js b/js/modal.js
index 1a692e6af..0b392d161 100644
--- a/js/modal.js
+++ b/js/modal.js
@@ -25,7 +25,7 @@
var Modal = function (element, options) {
this.options = options
- this.$element = $(element).on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+ this.$element = $(element)
this.$backdrop =
this.isShown = null
@@ -54,6 +54,8 @@
this.escape()
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 2c610d83d..5755d2751 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -174,4 +174,23 @@ $(function () {
})
.modal("show")
})
+
+ test("should close reopened modal with [data-dismiss=modal] click", function () {
+ stop()
+ $.support.transition = false
+ var div = $("<div id='modal-test'><div class='contents'><div id='close' data-dismiss='modal'></div></div></div>")
+ div
+ .bind("shown.bs.modal", function () {
+ $('#close').click()
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
+ })
+ .one("hidden.bs.modal", function() {
+ div.one('hidden.bs.modal', function () {
+ start()
+ }).modal("show")
+ })
+ .modal("show")
+
+ div.remove()
+ })
})