diff options
| author | Mark Otto <[email protected]> | 2013-05-27 19:23:17 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-05-27 19:23:17 -0700 |
| commit | 8899c30f16a32f1c3237242abf5e1bde5d88d0ca (patch) | |
| tree | 47b8b4f0e38af1f48c1c632982aed23e799d4e03 /js/tests/unit | |
| parent | 60575dfb461d5e01d36b564dccc55ef260982081 (diff) | |
| parent | a7a87c8e8c3343f6d9dea868d578178de8907f98 (diff) | |
| download | bootstrap-8899c30f16a32f1c3237242abf5e1bde5d88d0ca.tar.xz bootstrap-8899c30f16a32f1c3237242abf5e1bde5d88d0ca.zip | |
Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip
Diffstat (limited to 'js/tests/unit')
| -rw-r--r-- | js/tests/unit/dropdown.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 09b5673a4..e45bd0a46 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -149,4 +149,71 @@ $(function () { $("#qunit-fixture").html("") }) + test("should fire show and hide event", function () { + var dropdownHTML = '<ul class="tabs">' + + '<li class="dropdown">' + + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + + '<ul class="dropdown-menu">' + + '<li><a href="#">Secondary link</a></li>' + + '<li><a href="#">Something else here</a></li>' + + '<li class="divider"></li>' + + '<li><a href="#">Another link</a></li>' + + '</ul>' + + '</li>' + + '</ul>' + , dropdown = $(dropdownHTML) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .dropdown() + + stop() + + dropdown + .parent('.dropdown') + .bind('show.bs.dropdown', function () { + ok(true, 'show was called') + }) + .bind('hide.bs.dropdown', function () { + ok(true, 'hide was called') + start() + }) + + dropdown.click() + $(document.body).click() + }) + + + test("should fire shown and hiden event", function () { + var dropdownHTML = '<ul class="tabs">' + + '<li class="dropdown">' + + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + + '<ul class="dropdown-menu">' + + '<li><a href="#">Secondary link</a></li>' + + '<li><a href="#">Something else here</a></li>' + + '<li class="divider"></li>' + + '<li><a href="#">Another link</a></li>' + + '</ul>' + + '</li>' + + '</ul>' + , dropdown = $(dropdownHTML) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .dropdown() + + stop() + + dropdown + .parent('.dropdown') + .bind('shown.bs.dropdown', function () { + ok(true, 'show was called') + }) + .bind('hidden.bs.dropdown', function () { + ok(true, 'hide was called') + start() + }) + + dropdown.click() + $(document.body).click() + }) + }) |
