aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/bootstrap-dropdown.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-01-31 13:18:34 -0800
committerJacob Thornton <[email protected]>2012-01-31 13:18:34 -0800
commit0bfbe5058d61ae93d82b09f1dff7eb30dc22426e (patch)
tree6ccf3dd9c36ff4b1f6cde5edbce21cdf0de78497 /js/tests/unit/bootstrap-dropdown.js
parent43cbc9440425b7c97c943690eefd14520de708e1 (diff)
parent4bd1ba4e0dc44d1d16161306576548f378ab1f8a (diff)
downloadbootstrap-0bfbe5058d61ae93d82b09f1dff7eb30dc22426e.tar.xz
bootstrap-0bfbe5058d61ae93d82b09f1dff7eb30dc22426e.zip
Merge branch '2.0-wip'
Conflicts: .gitignore LICENSE Makefile bootstrap.css bootstrap.min.css docs/assets/js/application.js docs/assets/js/google-code-prettify/prettify.css docs/index.html docs/javascript.html examples/container-app.html examples/fluid.html examples/hero.html js/bootstrap-alerts.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tabs.js js/bootstrap-twipsy.js js/tests/index.html js/tests/unit/bootstrap-modal.js js/tests/unit/bootstrap-popover.js js/tests/unit/bootstrap-tabs.js lib/forms.less lib/mixins.less lib/patterns.less lib/scaffolding.less lib/tables.less
Diffstat (limited to 'js/tests/unit/bootstrap-dropdown.js')
-rw-r--r--js/tests/unit/bootstrap-dropdown.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/bootstrap-dropdown.js
index 2c2acb9bb..368ced2a5 100644
--- a/js/tests/unit/bootstrap-dropdown.js
+++ b/js/tests/unit/bootstrap-dropdown.js
@@ -13,7 +13,7 @@ $(function () {
test("should add class open to menu if clicked", function () {
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
- + '<a href="#" class="dropdown-toggle">Dropdown</a>'
+ + '<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>'
@@ -22,16 +22,15 @@ $(function () {
+ '</ul>'
+ '</li>'
+ '</ul>'
- , dropdown = $(dropdownHTML).dropdown()
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
- dropdown.find('.dropdown-toggle').click()
- ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
})
test("should remove open class if body clicked", function () {
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
- + '<a href="#" class="dropdown-toggle">Dropdown</a>'
+ + '<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>'
@@ -40,12 +39,14 @@ $(function () {
+ '</ul>'
+ '</li>'
+ '</ul>'
- , dropdown = $(dropdownHTML).dropdown().appendTo('#qunit-runoff')
-
- dropdown.find('.dropdown-toggle').click()
- ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
+ , dropdown = $(dropdownHTML)
+ .appendTo('#qunit-fixture')
+ .find('[data-toggle="dropdown"]')
+ .dropdown()
+ .click()
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
$('body').click()
- ok(!dropdown.find('.dropdown').hasClass('open'), 'open class removed')
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
dropdown.remove()
})