c534440057eb709a2b9640bc507c1d93d7e9c7b1
[myslice.git] / third-party / jquery-ui-1.10.2 / tests / unit / button / button_methods.js
1 /*
2  * button_methods.js
3  */
4 (function($) {
5
6
7 module("button: methods");
8
9 test("destroy", function() {
10         expect( 1 );
11         domEqual( "#button", function() {
12                 $( "#button" ).button().button( "destroy" );
13         });
14 });
15
16 test( "refresh: Ensure disabled state is preserved correctly.", function() {
17         expect( 8 );
18         
19         var element = $( "<a href='#'></a>" );
20         element.button({ disabled: true }).button( "refresh" );
21         ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237
22
23         element = $( "<div></div>" );
24         element.button({ disabled: true }).button( "refresh" );
25         ok( element.button( "option", "disabled" ), "<div> buttons should remain disabled after refresh" );
26
27         element = $( "<button></button>" );
28         element.button( { disabled: true} ).button( "refresh" );
29         ok( element.button( "option", "disabled" ), "<button> should remain disabled after refresh");
30
31         element = $( "<input type='checkbox'>" );
32         element.button( { disabled: true} ).button( "refresh" );
33         ok( element.button( "option", "disabled" ), "Checkboxes should remain disabled after refresh");
34
35         element = $( "<input type='radio'>" );
36         element.button( { disabled: true} ).button( "refresh" );
37         ok( element.button( "option", "disabled" ), "Radio buttons should remain disabled after refresh");
38
39         element = $( "<button></button>" );
40         element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
41         ok( !element.button( "option", "disabled" ), "Changing a <button>'s disabled property should update the state after refresh."); //See #8828
42
43         element = $( "<input type='checkbox'>" );
44         element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
45         ok( !element.button( "option", "disabled" ), "Changing a checkbox's disabled property should update the state after refresh.");
46
47         element = $( "<input type='radio'>" );
48         element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
49         ok( !element.button( "option", "disabled" ), "Changing a radio button's disabled property should update the state after refresh.");
50 });
51
52 })(jQuery);