@@ -8,8 +8,7 @@ module( "Checkboxradio: options" );
88function assertDisabled ( checkbox , assert ) {
99 assert . hasClasses ( checkbox . checkboxradio ( "widget" ) , "ui-state-disabled" ,
1010 "label gets ui-state-disabled" ) ;
11- strictEqual ( checkbox . is ( ":disabled" ) , true ,
12- "checkbox is disabled" ) ;
11+ strictEqual ( checkbox . is ( ":disabled" ) , true , "checkbox is disabled" ) ;
1312}
1413
1514function assertEnabled ( checkbox , assert ) {
@@ -20,8 +19,9 @@ function assertEnabled( checkbox, assert ) {
2019}
2120
2221test ( "disabled" , function ( assert ) {
23- var checkbox = $ ( "#checkbox-option-disabled" ) ;
2422 expect ( 6 ) ;
23+
24+ var checkbox = $ ( "#checkbox-option-disabled" ) ;
2525 checkbox . checkboxradio ( {
2626 disabled : true
2727 } ) ;
@@ -34,6 +34,7 @@ test( "disabled", function( assert ) {
3434 checkbox . checkboxradio ( "option" , "disabled" , true ) ;
3535 assertDisabled ( checkbox , assert ) ;
3636} ) ;
37+
3738test ( "disabled - prop true on init" , function ( assert ) {
3839 expect ( 2 ) ;
3940 var checkbox = $ ( "#checkbox-option-disabled" ) ;
@@ -43,6 +44,7 @@ test( "disabled - prop true on init", function( assert ) {
4344
4445 assertDisabled ( checkbox , assert ) ;
4546} ) ;
47+
4648test ( "disabled - explicit null value, checks the DOM" , function ( assert ) {
4749 expect ( 2 ) ;
4850 var checkbox = $ ( "#checkbox-option-disabled" ) ;
@@ -58,6 +60,7 @@ function assertNoIcon( checkbox ) {
5860 strictEqual ( checkbox . checkboxradio ( "widget" ) . find ( "span.ui-icon" ) . length , 0 ,
5961 "Label does not contain an icon" ) ;
6062}
63+
6164function assertIcon ( checkbox , icon , assert ) {
6265 var iconElement = checkbox . checkboxradio ( "widget" ) . find ( ".ui-icon" ) ;
6366
@@ -71,6 +74,7 @@ function assertIcon( checkbox, icon, assert ) {
7174 assert . lacksClasses ( iconElement , "ui-icon-check ui-state-highlight" ) ;
7275 }
7376}
77+
7478test ( "icon - false on init" , function ( ) {
7579 var checkbox = $ ( "#checkbox-option-icon" ) ;
7680
@@ -79,6 +83,7 @@ test( "icon - false on init", function() {
7983 checkbox . checkboxradio ( { icon : false } ) ;
8084 assertNoIcon ( checkbox ) ;
8185} ) ;
86+
8287test ( "icon - default unchecked" , function ( assert ) {
8388 var checkbox = $ ( "#checkbox-option-icon" ) ;
8489
@@ -87,6 +92,7 @@ test( "icon - default unchecked", function( assert ) {
8792 checkbox . checkboxradio ( ) ;
8893 assertIcon ( checkbox , false , assert ) ;
8994} ) ;
95+
9096test ( "icon - default checked" , function ( assert ) {
9197 var checkbox = $ ( "#checkbox-option-icon" ) . attr ( "checked" , true ) ;
9298
@@ -95,6 +101,7 @@ test( "icon - default checked", function( assert ) {
95101 checkbox . checkboxradio ( ) ;
96102 assertIcon ( checkbox , "check ui-state-highlight" , assert ) ;
97103} ) ;
104+
98105test ( "icon" , function ( assert ) {
99106 var checkbox = $ ( "#checkbox-option-icon" ) ;
100107
@@ -117,7 +124,6 @@ test( "icon", function( assert ) {
117124 checkbox . checkboxradio ( "option" , "icon" , true ) ;
118125 checkbox . prop ( "checked" , false ) . checkboxradio ( "refresh" ) ;
119126 assertIcon ( checkbox , false , assert ) ;
120-
121127} ) ;
122128
123129test ( "label - default" , function ( ) {
@@ -133,6 +139,7 @@ test( "label - default", function() {
133139 strictEqual ( $ . trim ( widget . text ( ) ) ,
134140 "checkbox label" , "When no value passed on create text from dom is used in dom" ) ;
135141} ) ;
142+
136143test ( "label - explicit value" , function ( ) {
137144 expect ( 5 ) ;
138145 var checkbox = $ ( "#checkbox-option-label" ) . checkboxradio ( {
@@ -160,9 +167,9 @@ test( "label - explicit null value", function() {
160167
161168 expect ( 2 ) ;
162169
163- // We are testing the default here because the default null is a special value which means to check
164- // the DOM, so we need to make sure this happens correctly checking the options should never return
165- // null. It should always be true or false
170+ // The default null is a special value which means to check the DOM.
171+ // We need to make sure that the option never return null.
172+ // It should always be true or false after initialization.
166173 checkbox . checkboxradio ( {
167174 label : null
168175 } ) ;
@@ -175,11 +182,11 @@ test( "label - explicit null value", function() {
175182} ) ;
176183
177184test ( "label" , function ( ) {
185+ expect ( 4 ) ;
186+
178187 var checkbox = $ ( "#checkbox-option-label" ) ,
179188 widget ;
180189
181- expect ( 4 ) ;
182-
183190 checkbox . checkboxradio ( ) ;
184191 widget = checkbox . checkboxradio ( "widget" ) ;
185192 checkbox . checkboxradio ( "option" , "label" , "bar" ) ;
@@ -193,7 +200,6 @@ test( "label", function() {
193200 "bar" , "When null is passed text from dom is used for option" ) ;
194201 strictEqual ( $ . trim ( widget . text ( ) ) ,
195202 "bar" , "When null is passed text from dom is used in dom" ) ;
196-
197203} ) ;
198204
199205} ) ;
0 commit comments