@@ -60,7 +60,7 @@ module( "Checkboxradio: checkbox: options" );
6060
6161 expect ( 9 ) ;
6262
63- checkbox . checkboxradio ( ) ;
63+ checkbox . checkboxradio ( { icon : false } ) ;
6464
6565 widget = checkbox . checkboxradio ( "widget" ) ;
6666
@@ -75,8 +75,8 @@ module( "Checkboxradio: checkbox: options" );
7575
7676 strictEqual ( widget . find ( "span" ) . length , 1 ,
7777 "Label contains a span when created with icon:true" ) ;
78- strictEqual ( widget . find ( "span" ) . attr ( "class" ) ,
79- "ui-checkboxradio- icon ui-corner-all ui-icon ui-icon- background ui-icon-blank" ,
78+ strictEqual ( widget . find ( "span" ) . is ( ".ui-checkboxradio-icon.ui-corner-all.ui-icon." +
79+ "ui-icon- background. ui-icon-blank" ) , true ,
8080 "Icon span has proper classes when created not checked" ) ;
8181
8282 checkbox . checkboxradio ( "destroy" ) . prop ( "checked" , true ) ;
@@ -85,8 +85,8 @@ module( "Checkboxradio: checkbox: options" );
8585 icon : true
8686 } ) ;
8787
88- strictEqual ( widget . find ( "span" ) . attr ( "class" ) ,
89- "ui-checkboxradio- icon ui-corner-all ui-icon ui-icon- background ui-icon-check" ,
88+ strictEqual ( widget . find ( "span" ) . is ( ".ui-checkboxradio-icon.ui-corner-all.ui-icon." +
89+ "ui-icon- background. ui-icon-check" ) , true ,
9090 "Icon span has proper classes when created checked" ) ;
9191
9292 checkbox . checkboxradio ( "option" , "icon" , false ) ;
@@ -96,8 +96,8 @@ module( "Checkboxradio: checkbox: options" );
9696
9797 checkbox . checkboxradio ( "option" , "icon" , true ) ;
9898
99- strictEqual ( widget . find ( "span" ) . attr ( "class" ) ,
100- "ui-checkboxradio- icon ui-corner-all ui-icon ui-icon- background ui-icon-check" ,
99+ strictEqual ( widget . find ( "span" ) . is ( ".ui-checkboxradio-icon.ui-corner-all.ui-icon." +
100+ "ui-icon- background. ui-icon-check" ) , true ,
101101 "Icon span has proper classes when option set to true and :is( checked )" ) ;
102102
103103 checkbox . prop ( "checked" , false ) . checkboxradio ( "refresh" ) ;
@@ -108,8 +108,8 @@ module( "Checkboxradio: checkbox: options" );
108108
109109 checkbox . checkboxradio ( "option" , "icon" , true ) ;
110110
111- strictEqual ( widget . find ( "span" ) . attr ( "class" ) ,
112- "ui-checkboxradio- icon ui-corner-all ui-icon ui-icon- background ui-icon-blank" ,
111+ strictEqual ( widget . find ( "span" ) . is ( ".ui-checkboxradio-icon.ui-corner-all.ui-icon." +
112+ "ui-icon- background. ui-icon-blank" ) , true ,
113113 "Icon span has proper classes when option set to true and not checked" ) ;
114114
115115 checkbox . checkboxradio ( "destroy" ) ;
@@ -118,6 +118,13 @@ module( "Checkboxradio: checkbox: options" );
118118 "Label does not contain a span after destroy when icon true" ) ;
119119
120120 } ) ;
121+ function getLabelText ( label , element ) {
122+ var text = "" ;
123+ label . contents ( ) . not ( element ) . each ( function ( ) {
124+ text += ( this . nodeType === 3 ) ? $ ( this ) . text ( ) : "" ;
125+ } ) ;
126+ return text ;
127+ }
121128 test ( "options: label" , function ( ) {
122129 var checkbox = $ ( "#checkbox-option-label" ) ,
123130 widget ;
@@ -130,7 +137,7 @@ module( "Checkboxradio: checkbox: options" );
130137
131138 strictEqual ( checkbox . checkboxradio ( "option" , "label" ) ,
132139 "checkbox label" , "When no value passed on create text from dom is used for option" ) ;
133- strictEqual ( widget . contents ( ) . not ( this . element ) ,
140+ strictEqual ( getLabelText ( widget , checkbox ) ,
134141 "checkbox label" , "When no value passed on create text from dom is used in dom" ) ;
135142
136143 checkbox . checkboxradio ( "destroy" ) ;
@@ -141,7 +148,7 @@ module( "Checkboxradio: checkbox: options" );
141148
142149 strictEqual ( checkbox . checkboxradio ( "option" , "label" ) ,
143150 "foo" , "When value is passed on create value is used for option" ) ;
144- strictEqual ( widget . contents ( ) . not ( this . element ) ,
151+ strictEqual ( getLabelText ( widget , checkbox ) ,
145152 "foo" , "When value is passed on create value is used in dom" ) ;
146153
147154 checkbox . checkboxradio ( "destroy" ) ;
@@ -151,21 +158,21 @@ module( "Checkboxradio: checkbox: options" );
151158
152159 strictEqual ( checkbox . checkboxradio ( "option" , "label" ) ,
153160 "foo" , "When null is passed on create text from dom is used for option" ) ;
154- strictEqual ( widget . contents ( ) . not ( this . element ) ,
161+ strictEqual ( getLabelText ( widget , checkbox ) ,
155162 "foo" , "When null is passed on create text from dom is used in dom" ) ;
156163
157164 checkbox . checkboxradio ( "option" , "label" , "bar" ) ;
158165
159166 strictEqual ( checkbox . checkboxradio ( "option" , "label" ) ,
160167 "bar" , "When value is passed value is used for option" ) ;
161- strictEqual ( widget . contents ( ) . not ( this . element ) ,
168+ strictEqual ( getLabelText ( widget , checkbox ) ,
162169 "bar" , "When value is passed value is used in dom" ) ;
163170
164171 checkbox . checkboxradio ( "option" , "label" , null ) ;
165172
166173 strictEqual ( checkbox . checkboxradio ( "option" , "label" ) ,
167174 "bar" , "When null is passed text from dom is used for option" ) ;
168- strictEqual ( widget . contents ( ) . not ( this . element ) ,
175+ strictEqual ( getLabelText ( widget , checkbox ) ,
169176 "bar" , "When null is passed text from dom is used in dom" ) ;
170177
171178 } ) ;
0 commit comments