diff options
| author | Mark Otto <[email protected]> | 2013-08-17 14:49:58 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-08-17 14:49:58 -0700 |
| commit | fdb7121f416048b2c06a90c4e00ab434e28e907e (patch) | |
| tree | e49b9ec3ee8e1cee21758a82724f51b1384b1542 /js | |
| parent | 3bcadfc2c560c5ecdb7fc943c34a721a49cb7309 (diff) | |
| parent | 484d51ce4897e81c018786b4ecc1825d4c67ee3c (diff) | |
| download | bootstrap-fdb7121f416048b2c06a90c4e00ab434e28e907e.tar.xz bootstrap-fdb7121f416048b2c06a90c4e00ab434e28e907e.zip | |
Merge branch '3.0.0-wip' of github.com:twbs/bootstrap into 3.0.0-wip
Diffstat (limited to 'js')
| -rw-r--r-- | js/modal.js | 4 | ||||
| -rw-r--r-- | js/tests/unit/modal.js | 19 |
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() + }) }) |
