text: $(function(){module("button");test("should provide no conflict",function(){var a=$.fn.button.noConflict();ok(!$.fn.button,"button was set back to undefined (org value)");$.fn.button=a});test("should be defined on jquery object",function(){ok($(document.body).button,"button method is defined")});test("should return element",function(){ok($(document.body).button()[0]==document.body,"document.body returned")});test("should return set state to loading",function(){var a=$('<button class="btn" data-loading-text="fat">mdo</button>');equals(a.html(),"mdo","btn text equals mdo");a.button("loading");equals(a.html(),"fat","btn text equals fat");stop();setTimeout(function(){ok(a.attr("disabled"),"btn is disabled");ok(a.hasClass("disabled"),"btn has disabled class");start()},0)});test("should return reset state",function(){var a=$('<button class="btn" data-loading-text="fat">mdo</button>');equals(a.html(),"mdo","btn text equals mdo");a.button("loading");equals(a.html(),"fat","btn text equals fat");stop();setTimeout(function(){ok(a.attr("disabled"),"btn is disabled");ok(a.hasClass("disabled"),"btn has disabled class");start();stop();a.button("reset");equals(a.html(),"mdo","btn text equals mdo");setTimeout(function(){ok(!a.attr("disabled"),"btn is not disabled");ok(!a.hasClass("disabled"),"btn does not have disabled class");start()},0)},0)});test("should toggle active",function(){var a=$('<button class="btn">mdo</button>');ok(!a.hasClass("active"),"btn does not have active class");a.button("toggle");ok(a.hasClass("active"),"btn has class active")});test("should toggle active when btn children are clicked",function(){var b=$('<button class="btn" data-toggle="button">mdo</button>'),a=$("<i></i>");b.append(a).appendTo($("#qunit-fixture"));ok(!b.hasClass("active"),"btn does not have active class");a.click();ok(b.hasClass("active"),"btn has class active")});test("should toggle active when btn children are clicked within btn-group",function(){var b=$('<div class="btn-group" data-toggle="buttons"></div>'),c=$('<button class="btn">fat</button>'),a=$("<i></i>");b.append(c.append(a)).appendTo($("#qunit-fixture"));ok(!c.hasClass("active"),"btn does not have active class");a.click();ok(c.hasClass("active"),"btn has class active")});test("should check for closest matching toggle",function(){var d='<div class="btn-group" data-toggle="buttons"><label class="btn btn-primary active"><input type="radio" name="options" id="option1" checked="true"> Option 1</label><label class="btn btn-primary"><input type="radio" name="options" id="option2"> Option 2</label><label class="btn btn-primary"><input type="radio" name="options" id="option3"> Option 3</label></div>';d=$(d);var c=$(d.children()[0]);var b=$(d.children()[1]);var a=$(d.children()[2]);d.appendTo($("#qunit-fixture"));ok(c.hasClass("active"),"btn1 has active class");ok(c.find("input").prop("checked"),"btn1 is checked");ok(!b.hasClass("active"),"btn2 does not have active class");ok(!b.find("input").prop("checked"),"btn2 is not checked");b.find("input").click();ok(!c.hasClass("active"),"btn1 does not have active class");ok(!c.find("input").prop("checked"),"btn1 is checked");ok(b.hasClass("active"),"btn2 has active class");ok(b.find("input").prop("checked"),"btn2 is checked")})});