@@ -8,8 +8,7 @@ module( "Checkboxradio: options" );
8
8
function assertDisabled ( checkbox , assert ) {
9
9
assert . hasClasses ( checkbox . checkboxradio ( "widget" ) , "ui-state-disabled" ,
10
10
"label gets ui-state-disabled" ) ;
11
- strictEqual ( checkbox . is ( ":disabled" ) , true ,
12
- "checkbox is disabled" ) ;
11
+ strictEqual ( checkbox . is ( ":disabled" ) , true , "checkbox is disabled" ) ;
13
12
}
14
13
15
14
function assertEnabled ( checkbox , assert ) {
@@ -20,8 +19,9 @@ function assertEnabled( checkbox, assert ) {
20
19
}
21
20
22
21
test ( "disabled" , function ( assert ) {
23
- var checkbox = $ ( "#checkbox-option-disabled" ) ;
24
22
expect ( 6 ) ;
23
+
24
+ var checkbox = $ ( "#checkbox-option-disabled" ) ;
25
25
checkbox . checkboxradio ( {
26
26
disabled : true
27
27
} ) ;
@@ -34,6 +34,7 @@ test( "disabled", function( assert ) {
34
34
checkbox . checkboxradio ( "option" , "disabled" , true ) ;
35
35
assertDisabled ( checkbox , assert ) ;
36
36
} ) ;
37
+
37
38
test ( "disabled - prop true on init" , function ( assert ) {
38
39
expect ( 2 ) ;
39
40
var checkbox = $ ( "#checkbox-option-disabled" ) ;
@@ -43,6 +44,7 @@ test( "disabled - prop true on init", function( assert ) {
43
44
44
45
assertDisabled ( checkbox , assert ) ;
45
46
} ) ;
47
+
46
48
test ( "disabled - explicit null value, checks the DOM" , function ( assert ) {
47
49
expect ( 2 ) ;
48
50
var checkbox = $ ( "#checkbox-option-disabled" ) ;
@@ -58,6 +60,7 @@ function assertNoIcon( checkbox ) {
58
60
strictEqual ( checkbox . checkboxradio ( "widget" ) . find ( "span.ui-icon" ) . length , 0 ,
59
61
"Label does not contain an icon" ) ;
60
62
}
63
+
61
64
function assertIcon ( checkbox , icon , assert ) {
62
65
var iconElement = checkbox . checkboxradio ( "widget" ) . find ( ".ui-icon" ) ;
63
66
@@ -71,6 +74,7 @@ function assertIcon( checkbox, icon, assert ) {
71
74
assert . lacksClasses ( iconElement , "ui-icon-check ui-state-highlight" ) ;
72
75
}
73
76
}
77
+
74
78
test ( "icon - false on init" , function ( ) {
75
79
var checkbox = $ ( "#checkbox-option-icon" ) ;
76
80
@@ -79,6 +83,7 @@ test( "icon - false on init", function() {
79
83
checkbox . checkboxradio ( { icon : false } ) ;
80
84
assertNoIcon ( checkbox ) ;
81
85
} ) ;
86
+
82
87
test ( "icon - default unchecked" , function ( assert ) {
83
88
var checkbox = $ ( "#checkbox-option-icon" ) ;
84
89
@@ -87,6 +92,7 @@ test( "icon - default unchecked", function( assert ) {
87
92
checkbox . checkboxradio ( ) ;
88
93
assertIcon ( checkbox , false , assert ) ;
89
94
} ) ;
95
+
90
96
test ( "icon - default checked" , function ( assert ) {
91
97
var checkbox = $ ( "#checkbox-option-icon" ) . attr ( "checked" , true ) ;
92
98
@@ -95,6 +101,7 @@ test( "icon - default checked", function( assert ) {
95
101
checkbox . checkboxradio ( ) ;
96
102
assertIcon ( checkbox , "check ui-state-highlight" , assert ) ;
97
103
} ) ;
104
+
98
105
test ( "icon" , function ( assert ) {
99
106
var checkbox = $ ( "#checkbox-option-icon" ) ;
100
107
@@ -117,7 +124,6 @@ test( "icon", function( assert ) {
117
124
checkbox . checkboxradio ( "option" , "icon" , true ) ;
118
125
checkbox . prop ( "checked" , false ) . checkboxradio ( "refresh" ) ;
119
126
assertIcon ( checkbox , false , assert ) ;
120
-
121
127
} ) ;
122
128
123
129
test ( "label - default" , function ( ) {
@@ -133,6 +139,7 @@ test( "label - default", function() {
133
139
strictEqual ( $ . trim ( widget . text ( ) ) ,
134
140
"checkbox label" , "When no value passed on create text from dom is used in dom" ) ;
135
141
} ) ;
142
+
136
143
test ( "label - explicit value" , function ( ) {
137
144
expect ( 5 ) ;
138
145
var checkbox = $ ( "#checkbox-option-label" ) . checkboxradio ( {
@@ -160,9 +167,9 @@ test( "label - explicit null value", function() {
160
167
161
168
expect ( 2 ) ;
162
169
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.
166
173
checkbox . checkboxradio ( {
167
174
label : null
168
175
} ) ;
@@ -175,11 +182,11 @@ test( "label - explicit null value", function() {
175
182
} ) ;
176
183
177
184
test ( "label" , function ( ) {
185
+ expect ( 4 ) ;
186
+
178
187
var checkbox = $ ( "#checkbox-option-label" ) ,
179
188
widget ;
180
189
181
- expect ( 4 ) ;
182
-
183
190
checkbox . checkboxradio ( ) ;
184
191
widget = checkbox . checkboxradio ( "widget" ) ;
185
192
checkbox . checkboxradio ( "option" , "label" , "bar" ) ;
@@ -193,7 +200,6 @@ test( "label", function() {
193
200
"bar" , "When null is passed text from dom is used for option" ) ;
194
201
strictEqual ( $ . trim ( widget . text ( ) ) ,
195
202
"bar" , "When null is passed text from dom is used in dom" ) ;
196
-
197
203
} ) ;
198
204
199
205
} ) ;
0 commit comments