6 module("button: options");
8 test("disabled, explicit value", function() {
10 $("#radio01").button({ disabled: false });
11 deepEqual(false, $("#radio01").button("option", "disabled"),
12 "disabled option set to false");
13 deepEqual(false, $("#radio01").prop("disabled"), "element is disabled");
15 $("#radio02").button({ disabled: true });
16 deepEqual(true, $("#radio02").button("option", "disabled"),
17 "disabled option set to true");
18 deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled");
21 test("disabled, null", function() {
23 $("#radio01").button({ disabled: null });
24 deepEqual(false, $("#radio01").button("option", "disabled"),
25 "disabled option set to false");
26 deepEqual(false, $("#radio01").prop("disabled"), "element is disabled");
28 $("#radio02").prop("disabled", true).button({ disabled: null });
29 deepEqual(true, $("#radio02").button("option", "disabled"),
30 "disabled option set to true");
31 deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled");
34 test("text false without icon", function() {
39 ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") );
41 $("#button").button("destroy");
44 test("text false with icon", function() {
52 ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") );
54 $("#button").button("destroy");
57 test("label, default", function() {
59 $("#button").button();
60 deepEqual( $("#button").text(), "Label" );
61 deepEqual( $( "#button").button( "option", "label" ), "Label" );
63 $("#button").button("destroy");
66 test("label", function() {
71 deepEqual( $("#button").text(), "xxx" );
72 deepEqual( $("#button").button( "option", "label" ), "xxx" );
74 $("#button").button("destroy");
77 test("label default with input type submit", function() {
79 deepEqual( $("#submit").button().val(), "Label" );
80 deepEqual( $("#submit").button( "option", "label" ), "Label" );
83 test("label with input type submit", function() {
85 var label = $("#submit").button({
88 deepEqual( label, "xxx" );
89 deepEqual( $("#submit").button( "option", "label" ), "xxx" );
92 test("icons", function() {
98 secondary: "iconclass2"
101 ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") );
103 $("#button").button("destroy");
106 test( "#5295 - button does not remove hoverstate if disabled" , function() {
108 var btn = $("#button").button();
109 btn.hover( function() {
110 btn.button( "disable" );
112 btn.trigger( "mouseenter" );
113 btn.trigger( "mouseleave" );
114 ok( !btn.is( ".ui-state-hover") );