Skip to content

Commit 44eb0cc

Browse files
jzaeffererarschmitz
authored andcommitted
Checkboxradio: Fix label option tests by trimming DOM text
IE8 is inconsistent in outputting space through .html() and .text() methods, but since it renders it correctly, we can just ignore it.
1 parent 2bf3073 commit 44eb0cc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/unit/checkboxradio/options.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ test( "label - default", function() {
120120
widget = checkbox.checkboxradio( "widget" );
121121
strictEqual( checkbox.checkboxradio( "option", "label" ),
122122
"checkbox label", "When no value passed on create text from dom is used for option" );
123-
strictEqual( widget.text(),
124-
" checkbox label", "When no value passed on create text from dom is used in dom" );
123+
strictEqual( $.trim( widget.text() ),
124+
"checkbox label", "When no value passed on create text from dom is used in dom" );
125125
} );
126126
test( "label - explicit value", function() {
127127
expect( 5 );
@@ -134,8 +134,8 @@ test( "label - explicit value", function() {
134134

135135
strictEqual( checkbox.checkboxradio( "option", "label" ),
136136
"foo", "When value is passed on create value is used for option" );
137-
strictEqual( widget.text(),
138-
" foo", "When value is passed on create value is used in dom" );
137+
strictEqual( $.trim( widget.text() ),
138+
"foo", "When value is passed on create value is used in dom" );
139139
strictEqual( icon.length, 1,
140140
"Icon is preserved when label is set on init when wrapped in label" );
141141
strictEqual( iconSpace.length, 1,
@@ -159,8 +159,8 @@ test( "label - explicit null value", function() {
159159
widget = checkbox.checkboxradio( "widget" );
160160
strictEqual( checkbox.checkboxradio( "option", "label" ),
161161
"checkbox label", "When null is passed on create text from dom is used for option" );
162-
strictEqual( widget.text(),
163-
" checkbox label", "When null is passed on create text from dom is used in dom" );
162+
strictEqual( $.trim( widget.text() ),
163+
"checkbox label", "When null is passed on create text from dom is used in dom" );
164164

165165
} );
166166

@@ -175,14 +175,14 @@ test( "label", function() {
175175
checkbox.checkboxradio( "option", "label", "bar" );
176176
strictEqual( checkbox.checkboxradio( "option", "label" ),
177177
"bar", "When value is passed value is used for option" );
178-
strictEqual( widget.text(),
179-
" bar", "When value is passed value is used in dom" );
178+
strictEqual( $.trim( widget.text() ),
179+
"bar", "When value is passed value is used in dom" );
180180

181181
checkbox.checkboxradio( "option", "label", null );
182182
strictEqual( checkbox.checkboxradio( "option", "label" ),
183183
"bar", "When null is passed text from dom is used for option" );
184-
strictEqual( widget.text(),
185-
" bar", "When null is passed text from dom is used in dom" );
184+
strictEqual( $.trim( widget.text() ),
185+
"bar", "When null is passed text from dom is used in dom" );
186186

187187
} );
188188

0 commit comments

Comments
 (0)