diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2011-12-21 06:02:47 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2011-12-21 06:02:47 +0400 |
commit | 1ef5fa7d6b4e50230c0c12919b0a06a9a2ac07f1 (patch) | |
tree | 72a3b02a1755096a9737451dea3030f0da65197d /js/tests/unit/bootstrap-modal.js | |
parent | 7df0d1c7d18a72f401094d08afa4eaa9142fe511 (diff) |
giant refactor - all spec passing again...
Diffstat (limited to 'js/tests/unit/bootstrap-modal.js')
-rw-r--r-- | js/tests/unit/bootstrap-modal.js | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/bootstrap-modal.js index 4bbb3313cc..22f5781ea6 100644 --- a/js/tests/unit/bootstrap-modal.js +++ b/js/tests/unit/bootstrap-modal.js @@ -10,6 +10,7 @@ $(function () { test("should return element", function () { var div = $("<div id='modal-test'></div>") ok(div.modal() == div, 'document.body returned') + $('#modal-test').remove() }) test("should expose defaults var for settings", function () { @@ -19,32 +20,29 @@ $(function () { test("should insert into dom when show method is called", function () { stop() $.support.transition = false - var div = $("<div id='modal-test'></div>") - div - .modal() - .modal("show") + $("<div id='modal-test'></div>") .bind("shown", function () { ok($('#modal-test').length, 'modal insterted into dom') + $(this).remove() start() - div.remove() }) + .modal("show") }) test("should hide modal when hide is called", function () { stop() $.support.transition = false - var div = $("<div id='modal-test'></div>") - div - .modal() + + $("<div id='modal-test'></div>") .bind("shown", function () { ok($('#modal-test').is(":visible"), 'modal visible') ok($('#modal-test').length, 'modal insterted into dom') - div.modal("hide") + $(this).modal("hide") }) .bind("hidden", function() { ok(!$('#modal-test').is(":visible"), 'modal hidden') + $('#modal-test').remove() start() - div.remove() }) .modal("show") }) @@ -54,7 +52,6 @@ $(function () { $.support.transition = false var div = $("<div id='modal-test'></div>") div - .modal() .bind("shown", function () { ok($('#modal-test').is(":visible"), 'modal visible') ok($('#modal-test').length, 'modal insterted into dom') @@ -62,18 +59,17 @@ $(function () { }) .bind("hidden", function() { ok(!$('#modal-test').is(":visible"), 'modal hidden') - start() div.remove() + start() }) .modal("toggle") }) - test("should remove from dom when click .close", function () { + test("should remove from dom when click [data-dismiss=modal]", function () { stop() $.support.transition = false - var div = $("<div id='modal-test'><span class='close'></span></div>") + var div = $("<div id='modal-test'><span class='close' data-dismiss='modal'></span></div>") div - .modal() .bind("shown", function () { ok($('#modal-test').is(":visible"), 'modal visible') ok($('#modal-test').length, 'modal insterted into dom') @@ -81,8 +77,8 @@ $(function () { }) .bind("hidden", function() { ok(!$('#modal-test').is(":visible"), 'modal hidden') - start() div.remove() + start() }) .modal("toggle") }) |