11define ( [
2+ "qunit" ,
23 "jquery" ,
34 "ui/widgets/button"
4- ] , function ( $ ) {
5+ ] , function ( QUnit , $ ) {
56
6- module ( "Button (deprecated): core" ) ;
7+ QUnit . module ( "Button (deprecated): core" ) ;
78
8- test ( "Calling button on a checkbox input calls checkboxradio widget" , function ( ) {
9+ QUnit . test ( "Calling button on a checkbox input calls checkboxradio widget" , function ( assert ) {
910 var checkbox = $ ( "#checkbox01" ) ;
1011
11- expect ( 2 ) ;
12+ assert . expect ( 2 ) ;
1213 checkbox . button ( ) ;
1314
14- ok ( ! ! checkbox . checkboxradio ( "instance" ) ,
15+ assert . ok ( ! ! checkbox . checkboxradio ( "instance" ) ,
1516 "Calling button on a checkbox creates checkboxradio instance" ) ;
16- ok ( ! checkbox . checkboxradio ( "option" , "icon" ) ,
17+ assert . ok ( ! checkbox . checkboxradio ( "option" , "icon" ) ,
1718 "Calling button on a checkbox sets the checkboxradio icon option to false" ) ;
1819} ) ;
1920
20- test ( "Calling buttonset calls controlgroup" , function ( ) {
21+ QUnit . test ( "Calling buttonset calls controlgroup" , function ( assert ) {
2122 var controlgroup = $ ( ".buttonset" ) ;
2223
23- expect ( 1 ) ;
24+ assert . expect ( 1 ) ;
2425 controlgroup . buttonset ( ) ;
2526
26- ok ( controlgroup . is ( ":ui-controlgroup" ) , "Calling buttonset creates controlgroup instance" ) ;
27+ assert . ok ( controlgroup . is ( ":ui-controlgroup" ) , "Calling buttonset creates controlgroup instance" ) ;
2728} ) ;
2829
29- module ( "Button (deprecated): methods" ) ;
30+ QUnit . module ( "Button (deprecated): methods" ) ;
3031
31- test ( "destroy" , function ( assert ) {
32- expect ( 1 ) ;
32+ QUnit . test ( "destroy" , function ( assert ) {
33+ assert . expect ( 1 ) ;
3334 assert . domEqual ( "#checkbox02" , function ( ) {
3435 $ ( "#checkbox02" ) . button ( ) . button ( "destroy" ) ;
3536 } ) ;
3637} ) ;
3738
38- test ( "refresh: Ensure disabled state is preserved correctly." , function ( ) {
39- expect ( 5 ) ;
39+ QUnit . test ( "refresh: Ensure disabled state is preserved correctly." , function ( assert ) {
40+ assert . expect ( 5 ) ;
4041 var element = null ;
4142
4243 element = $ ( "#checkbox02" ) ;
4344 element . button ( { disabled : true } ) . button ( "refresh" ) ;
44- ok ( element . button ( "option" , "disabled" ) , "Checkboxes should remain disabled after refresh" ) ;
45- ok ( element . prop ( "disabled" ) , "Input remains disabled after refresh" ) ;
45+ assert . ok ( element . button ( "option" , "disabled" ) , "Checkboxes should remain disabled after refresh" ) ;
46+ assert . ok ( element . prop ( "disabled" ) , "Input remains disabled after refresh" ) ;
4647
4748 element = $ ( "#radio02" ) ;
4849 element . button ( { disabled : true } ) . button ( "refresh" ) ;
49- ok ( element . button ( "option" , "disabled" ) , "Radio buttons should remain disabled after refresh" ) ;
50+ assert . ok ( element . button ( "option" , "disabled" ) , "Radio buttons should remain disabled after refresh" ) ;
5051
5152 element = $ ( "#checkbox02" ) ;
5253 element . button ( { disabled : true } ) . prop ( "disabled" , false ) . button ( "refresh" ) ;
53- ok ( ! element . button ( "option" , "disabled" ) , "Changing a checkbox's disabled property should update the state after refresh." ) ;
54+ assert . ok ( ! element . button ( "option" , "disabled" ) , "Changing a checkbox's disabled property should update the state after refresh." ) ;
5455
5556 element = $ ( "#radio02" ) ;
5657 element . button ( { disabled : true } ) . prop ( "disabled" , false ) . button ( "refresh" ) ;
57- ok ( ! element . button ( "option" , "disabled" ) , "Changing a radio button's disabled property should update the state after refresh." ) ;
58+ assert . ok ( ! element . button ( "option" , "disabled" ) , "Changing a radio button's disabled property should update the state after refresh." ) ;
5859
5960} ) ;
6061
61- module ( "button (deprecated): options" ) ;
62+ QUnit . module ( "button (deprecated): options" ) ;
6263
63- test ( "Setting items option on buttonset sets the button properties on the items option" , function ( ) {
64- expect ( 2 ) ;
64+ QUnit . test ( "Setting items option on buttonset sets the button properties on the items option" , function ( assert ) {
65+ assert . expect ( 2 ) ;
6566
6667 var controlgroup = $ ( ".buttonset" ) ;
6768
6869 controlgroup . buttonset ( { items : "bar" } ) ;
69- equal ( controlgroup . controlgroup ( "option" , "items.button" ) , "bar" ,
70+ assert . equal ( controlgroup . controlgroup ( "option" , "items.button" ) , "bar" ,
7071 "items.button set when setting items option on init on buttonset" ) ;
7172
7273 controlgroup . buttonset ( "option" , "items" , "foo" ) ;
73- equal ( controlgroup . controlgroup ( "option" , "items.button" ) , "foo" ,
74+ assert . equal ( controlgroup . controlgroup ( "option" , "items.button" ) , "foo" ,
7475 "items.button set when setting items option on buttonset" ) ;
7576} ) ;
7677
77- test ( "disabled, null" , function ( ) {
78- expect ( 2 ) ;
78+ QUnit . test ( "disabled, null" , function ( assert ) {
79+ assert . expect ( 2 ) ;
7980
8081 $ ( "#radio02" ) . prop ( "disabled" , true ) . button ( { disabled : null } ) ;
81- deepEqual ( $ ( "#radio02" ) . button ( "option" , "disabled" ) , true ,
82+ assert . deepEqual ( $ ( "#radio02" ) . button ( "option" , "disabled" ) , true ,
8283 "disabled option set to true" ) ;
83- deepEqual ( true , $ ( "#radio02" ) . prop ( "disabled" ) , "element is not disabled" ) ;
84+ assert . deepEqual ( true , $ ( "#radio02" ) . prop ( "disabled" ) , "element is not disabled" ) ;
8485} ) ;
8586
86- test ( "text / showLabel options proxied" , function ( ) {
87- expect ( 8 ) ;
87+ QUnit . test ( "text / showLabel options proxied" , function ( assert ) {
88+ assert . expect ( 8 ) ;
8889 var button = $ ( "#button" ) ;
8990 button . button ( {
9091 text : false ,
9192 icon : "ui-icon-gear"
9293 } ) ;
93- equal ( button . button ( "option" , "showLabel" ) , false ,
94+ assert . equal ( button . button ( "option" , "showLabel" ) , false ,
9495 "Setting the text option to false sets the showLabel option to false on init" ) ;
9596 button . button ( "option" , "showLabel" , true ) ;
96- equal ( button . button ( "option" , "text" ) , true ,
97+ assert . equal ( button . button ( "option" , "text" ) , true ,
9798 "Setting showLabel true with option method sets text option to true" ) ;
9899 button . button ( "option" , "text" , false ) ;
99- equal ( button . button ( "option" , "showLabel" ) , false ,
100+ assert . equal ( button . button ( "option" , "showLabel" ) , false ,
100101 "Setting text false with option method sets showLabel option to false" ) ;
101102 button . button ( "option" , "text" , true ) ;
102- equal ( button . button ( "option" , "showLabel" ) , true ,
103+ assert . equal ( button . button ( "option" , "showLabel" ) , true ,
103104 "Setting text true with option method sets showLabel option to true" ) ;
104105 button . button ( "option" , "showLabel" , false ) ;
105- equal ( button . button ( "option" , "text" ) , false ,
106+ assert . equal ( button . button ( "option" , "text" ) , false ,
106107 "Setting showLabel false with option method sets text option to false" ) ;
107108 button . button ( "destroy" ) ;
108109 button . button ( {
109110 text : true ,
110111 icon : "ui-icon-gear"
111112 } ) ;
112- equal ( button . button ( "option" , "showLabel" ) , true ,
113+ assert . equal ( button . button ( "option" , "showLabel" ) , true ,
113114 "Setting the text option to true sets the showLabel option to true on init" ) ;
114115 button . button ( "destroy" ) ;
115116 button . button ( {
116117 showLabel : true ,
117118 icon : "ui-icon-gear"
118119 } ) ;
119- equal ( button . button ( "option" , "text" ) , true ,
120+ assert . equal ( button . button ( "option" , "text" ) , true ,
120121 "Setting the showLabel option to true sets the text option to true on init" ) ;
121122 button . button ( "destroy" ) ;
122123 button . button ( {
123124 showLabel : false ,
124125 icon : "ui-icon-gear"
125126 } ) ;
126- equal ( button . button ( "option" , "text" ) , false ,
127+ assert . equal ( button . button ( "option" , "text" ) , false ,
127128 "Setting the showLabel option to false sets the text option to false on init" ) ;
128129} ) ;
129130
130- test ( "icon / icons options properly proxied" , function ( ) {
131- expect ( 10 ) ;
131+ QUnit . test ( "icon / icons options properly proxied" , function ( assert ) {
132+ assert . expect ( 10 ) ;
132133
133134 var button = $ ( "#button" ) ;
134135
135136 button . button ( {
136137 icon : "foo"
137138 } ) ;
138139
139- equal ( button . button ( "option" , "icons.primary" ) , "foo" ,
140+ assert . equal ( button . button ( "option" , "icons.primary" ) , "foo" ,
140141 "Icon option properly proxied on init" ) ;
141142
142143 button . button ( {
143144 icon : "bar"
144145 } ) ;
145146
146- equal ( button . button ( "option" , "icons.primary" ) , "bar" ,
147+ assert . equal ( button . button ( "option" , "icons.primary" ) , "bar" ,
147148 "Icon option properly proxied with option method" ) ;
148149
149150 button . button ( {
@@ -152,9 +153,9 @@ test( "icon / icons options properly proxied", function() {
152153 }
153154 } ) ;
154155
155- equal ( button . button ( "option" , "icon" ) , "foo" ,
156+ assert . equal ( button . button ( "option" , "icon" ) , "foo" ,
156157 "Icons primary option properly proxied with option method" ) ;
157- equal ( button . button ( "option" , "iconPosition" ) , "beginning" ,
158+ assert . equal ( button . button ( "option" , "iconPosition" ) , "beginning" ,
158159 "Icons primary option sets iconPosition option to beginning" ) ;
159160
160161 button . button ( {
@@ -163,9 +164,9 @@ test( "icon / icons options properly proxied", function() {
163164 }
164165 } ) ;
165166
166- equal ( button . button ( "option" , "icon" ) , "bar" ,
167+ assert . equal ( button . button ( "option" , "icon" ) , "bar" ,
167168 "Icons secondary option properly proxied with option method" ) ;
168- equal ( button . button ( "option" , "iconPosition" ) , "end" ,
169+ assert . equal ( button . button ( "option" , "iconPosition" ) , "end" ,
169170 "Icons secondary option sets iconPosition option to end" ) ;
170171
171172 button . button ( "destroy" ) ;
@@ -176,9 +177,9 @@ test( "icon / icons options properly proxied", function() {
176177 }
177178 } ) ;
178179
179- equal ( button . button ( "option" , "icon" ) , "foo" ,
180+ assert . equal ( button . button ( "option" , "icon" ) , "foo" ,
180181 "Icons primary option properly proxied on init" ) ;
181- equal ( button . button ( "option" , "iconPosition" ) , "beginning" ,
182+ assert . equal ( button . button ( "option" , "iconPosition" ) , "beginning" ,
182183 "Icons primary option sets iconPosition option to beginning on init" ) ;
183184
184185 button . button ( {
@@ -187,9 +188,9 @@ test( "icon / icons options properly proxied", function() {
187188 }
188189 } ) ;
189190
190- equal ( button . button ( "option" , "icon" ) , "bar" ,
191+ assert . equal ( button . button ( "option" , "icon" ) , "bar" ,
191192 "Icons secondary option properly proxied on init" ) ;
192- equal ( button . button ( "option" , "iconPosition" ) , "end" ,
193+ assert . equal ( button . button ( "option" , "iconPosition" ) , "end" ,
193194 "Icons secondary option sets iconPosition option to end on init" ) ;
194195} ) ;
195196
0 commit comments