From 3d58b4622671bc51c22c857641db3b988e73632a Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 18 Feb 2012 23:29:58 -0800 Subject: fix bootstrap-button toggle regression + tests --- js/tests/unit/bootstrap-button.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'js/tests') diff --git a/js/tests/unit/bootstrap-button.js b/js/tests/unit/bootstrap-button.js index 8aed857e11..03c4a8e9d5 100644 --- a/js/tests/unit/bootstrap-button.js +++ b/js/tests/unit/bootstrap-button.js @@ -45,10 +45,33 @@ $(function () { }) test("should toggle active", function () { - var btn = $('') + var btn = $('') ok(!btn.hasClass('active'), 'btn does not have active class') btn.button('toggle') ok(btn.hasClass('active'), 'btn has class active') }) + test("should toggle active when btn children are clicked", function () { + var btn = $('') + , inner = $('') + btn + .append(inner) + .appendTo($('#qunit-fixture')) + ok(!btn.hasClass('active'), 'btn does not have active class') + inner.click() + ok(btn.hasClass('active'), 'btn has class active') + }) + + test("should toggle active when btn children are clicked within btn-group", function () { + var btngroup = $('
') + , btn = $('') + , inner = $('') + btngroup + .append(btn.append(inner)) + .appendTo($('#qunit-fixture')) + ok(!btn.hasClass('active'), 'btn does not have active class') + inner.click() + ok(btn.hasClass('active'), 'btn has class active') + }) + }) \ No newline at end of file -- cgit v1.2.3