From d65f7f204a918906d7ce5120b9719abf105d60c5 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 14 Apr 2012 21:44:57 -0700 Subject: don't open dropdown if target is disabled --- js/tests/unit/bootstrap-dropdown.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'js/tests') 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 = '' + , 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 = '' + , 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 = '