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
path: root/js
diff options
context:
space:
mode:
authorfat <jacobthornton@gmail.com>2013-08-18 01:24:38 +0400
committerfat <jacobthornton@gmail.com>2013-08-18 01:24:38 +0400
commit712b89ed4ebe71e44f2a7081be7ba372d8ca3f42 (patch)
treef0a86f3d11841bedee5f120263b1d3c9cdd1e547 /js
parent728a5e17d667422cdad791e06375e8e9a0f80cc1 (diff)
fixes #9362
Diffstat (limited to 'js')
-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 1a692e6af1..0b392d1615 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 2c610d83d9..5755d27511 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()
+ })
})