Skip to content

Commit

Permalink
fixes #9362
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Aug 17, 2013
1 parent 728a5e1 commit 712b89e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/modal.js
Expand Up @@ -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

Expand Down Expand Up @@ -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')

Expand Down
19 changes: 19 additions & 0 deletions js/tests/unit/modal.js
Expand Up @@ -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()
})
})

0 comments on commit 712b89e

Please sign in to comment.