1
1
/*
2
- * button_options_deprecated .js
2
+ * button_core .js
3
3
*/
4
+
5
+
4
6
( function ( $ ) {
5
7
6
- module ( "button: options deprecated" ) ;
8
+ module ( "Button (deprecated): core" ) ;
9
+
10
+ test ( "Calling button on a checkbox input calls checkboxradio widget" , function ( ) {
11
+ var checkbox = $ ( "#checkbox01" ) ;
12
+
13
+ expect ( 2 ) ;
14
+ checkbox . button ( ) ;
15
+
16
+ ok ( checkbox . is ( ":ui-checkboxradio" ) ,
17
+ "Calling button on a checkbox creates checkboxradio instance" ) ;
18
+ ok ( ! checkbox . checkboxradio ( "option" , "icon" ) ,
19
+ "Calling button on a checkbox sets the checkboxradio icon option to false" ) ;
20
+ } ) ;
21
+
22
+ test ( "Calling buttonset calls controlgroup" , function ( ) {
23
+ var controlgroup = $ ( ".buttonset" ) ;
24
+
25
+ expect ( 1 ) ;
26
+ controlgroup . buttonset ( ) ;
27
+
28
+ ok ( controlgroup . is ( ":ui-controlgroup" ) , "Calling buttonset creates controlgroup instance" ) ;
29
+ } ) ;
30
+
31
+ module ( "Button (deprecated): methods" ) ;
32
+
33
+ test ( "destroy" , function ( ) {
34
+ expect ( 1 ) ;
35
+ domEqual ( "#checkbox02" , function ( ) {
36
+ $ ( "#checkbox02" ) . button ( ) . button ( "destroy" ) ;
37
+ } ) ;
38
+ } ) ;
39
+
40
+ test ( "refresh: Ensure disabled state is preserved correctly." , function ( ) {
41
+ expect ( 4 ) ;
42
+ var element = null ;
43
+
44
+ element = $ ( "#checkbox02" ) ;
45
+ element . button ( { disabled : true } ) . button ( "refresh" ) ;
46
+ ok ( element . button ( "option" , "disabled" ) , "Checkboxes should remain disabled after refresh" ) ;
47
+
48
+ element = $ ( "#radio02" ) ;
49
+ element . button ( { disabled : true } ) . button ( "refresh" ) ;
50
+ ok ( element . button ( "option" , "disabled" ) , "Radio buttons should remain disabled after refresh" ) ;
51
+
52
+ element = $ ( "#checkbox02" ) ;
53
+ element . button ( { disabled : true } ) . prop ( "disabled" , false ) . button ( "refresh" ) ;
54
+ ok ( ! element . button ( "option" , "disabled" ) , "Changing a checkbox's disabled property should update the state after refresh." ) ;
55
+
56
+ element = $ ( "#radio02" ) ;
57
+ element . button ( { disabled : true } ) . prop ( "disabled" , false ) . button ( "refresh" ) ;
58
+ ok ( ! element . button ( "option" , "disabled" ) , "Changing a radio button's disabled property should update the state after refresh." ) ;
59
+
60
+ } ) ;
61
+
62
+ module ( "button (deprecated): options" ) ;
7
63
8
64
test ( "Setting items option on button set sets the button properties on the items option" , function ( ) {
9
65
expect ( 2 ) ;
@@ -138,4 +194,4 @@ test( "icon and icons options properly proxied", function(){
138
194
"Icons secondary option sets iconPosition option to end on init" ) ;
139
195
} ) ;
140
196
141
- } ) ( jQuery ) ;
197
+ } ) ( jQuery ) ;
0 commit comments