aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-04-14 23:07:51 -0700
committerMark Otto <[email protected]>2012-04-14 23:07:51 -0700
commit2dbce887df8ffec477929c92085745af9b93feaa (patch)
tree09fbf6161b08eef8e66a5089b3b1f6886324164f /js/tests
parenta6f27ebed440919aac6f62e73e6748bfecd00ab9 (diff)
parentc7dc4cc573c61306ae849d316f432160b16a2099 (diff)
downloadbootstrap-2dbce887df8ffec477929c92085745af9b93feaa.tar.xz
bootstrap-2dbce887df8ffec477929c92085745af9b93feaa.zip
Merge branch '2.0.3-wip' of github.com:twitter/bootstrap into 2.0.3-wip
Conflicts: docs/assets/bootstrap.zip
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/bootstrap-dropdown.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/bootstrap-dropdown.js
index 368ced2a5..4e52c8485 100644
--- a/js/tests/unit/bootstrap-dropdown.js
+++ b/js/tests/unit/bootstrap-dropdown.js
@@ -10,6 +10,40 @@ $(function () {
ok($(document.body).dropdown()[0] == document.body, 'document.body returned')
})
+ test("should not open dropdown if target is disabled", function () {
+ var dropdownHTML = '<ul class="tabs">'
+ + '<li class="dropdown">'
+ + '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>'
+ + '<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).find('[data-toggle="dropdown"]').dropdown().click()
+
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
+ })
+
+ test("should not open dropdown if target is disabled", function () {
+ var dropdownHTML = '<ul class="tabs">'
+ + '<li class="dropdown">'
+ + '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>'
+ + '<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).find('[data-toggle="dropdown"]').dropdown().click()
+
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
+ })
+
test("should add class open to menu if clicked", function () {
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'