Skip to content

Commit 3570cc5

Browse files
committed
Tests: Fix button space assertions on IE8
IE8 still doesn't keep the space in the text (or HTML) representation. We don't really care, so adding more trims in these tests as well.
1 parent 56d6ddc commit 3570cc5

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

tests/unit/dialog/options.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ test( "buttons - advanced", function( assert ) {
165165
buttons = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
166166
equal( buttons.length, 1, "correct number of buttons" );
167167
equal( buttons.attr( "id" ), "my-button-id", "correct id" );
168-
equal( buttons.text().trim(), "a button", "correct label" );
168+
equal( $.trim( buttons.text() ), "a button", "correct label" );
169169
assert.hasClasses( buttons, "additional-class" );
170170
deepEqual( buttons.button( "option", "icon" ), "ui-icon-cancel" );
171171
equal( buttons.button( "option", "showLabel" ), false );
@@ -209,17 +209,17 @@ test( "closeText", function() {
209209
expect( 3 );
210210

211211
var element = $( "<div></div>" ).dialog();
212-
equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "Close",
212+
equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "Close",
213213
"default close text" );
214214
element.remove();
215215

216216
element = $( "<div></div>" ).dialog( { closeText: "foo" } );
217-
equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "foo",
217+
equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "foo",
218218
"closeText on init" );
219219
element.remove();
220220

221221
element = $( "<div></div>" ).dialog().dialog( "option", "closeText", "bar" );
222-
equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "bar",
222+
equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "bar",
223223
"closeText via option method" );
224224
element.remove();
225225
} );

tests/unit/selectmenu/core.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ test( "_renderButtonItem()", function() {
8989
element.selectmenu( "refresh" );
9090
option = element.find( "option:selected" );
9191
equal(
92-
" " + option.text() + element[ 0 ].selectedIndex,
93-
button.text(),
92+
$.trim( button.text() ),
93+
option.text() + element[ 0 ].selectedIndex,
9494
"refresh: button item text"
9595
);
9696

9797
button.trigger( "click" );
9898
menu.find( "li" ).last().simulate( "mouseover" ).trigger( "click" );
9999
option = element.find( "option" ).last();
100100
equal(
101-
" " + option.text() + element[ 0 ].selectedIndex,
102-
button.text(),
101+
$.trim( button.text() ),
102+
option.text() + element[ 0 ].selectedIndex,
103103
"click: button item text"
104104
);
105105
} );
@@ -146,7 +146,7 @@ $.each( [
146146
selected.val(),
147147
"original select state"
148148
);
149-
equal( button.text(), " " + selected.text(), "button text" );
149+
equal( $.trim( button.text() ), selected.text(), "button text" );
150150
start();
151151
} );
152152
} );
@@ -181,7 +181,7 @@ $.each( [
181181
selected.val(),
182182
"original select state"
183183
);
184-
equal( button.text(), " " + selected.text(), "button text" );
184+
equal( $.trim( button.text() ), selected.text(), "button text" );
185185
start();
186186
}, 1 );
187187
} );
@@ -222,7 +222,7 @@ $.each( [
222222
"button aria-activedescendant" );
223223
equal( element.find( "option:selected" ).val(), options.eq( 1 ).val(),
224224
"original select state" );
225-
equal( button.text(), " " + options.eq( 1 ).text(), "button text" );
225+
equal( $.trim( button.text() ), options.eq( 1 ).text(), "button text" );
226226
start();
227227
} );
228228
} );

tests/unit/selectmenu/methods.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ asyncTest( "refresh - change selected option", function() {
8181
var element = $( "#speed" ).selectmenu(),
8282
button = element.selectmenu( "widget" );
8383

84-
equal( button.text(), " Medium", "button text after init" );
84+
equal( $.trim( button.text() ), "Medium", "button text after init" );
8585

8686
button.simulate( "focus" );
8787

8888
setTimeout( function() {
89-
equal( button.text(), " Medium", "button text after focus" );
89+
equal( $.trim( button.text() ), "Medium", "button text after focus" );
9090

9191
element[ 0 ].selectedIndex = 0;
9292
element.selectmenu( "refresh" );
93-
equal( button.text(), " Slower", "button text after changing selected option" );
93+
equal( $.trim( button.text() ), "Slower", "button text after changing selected option" );
9494

9595
element.find( "option" ).prop( "selected", false );
9696
element.append( "<option selected value=\"selected_option\">Selected option</option>" );
9797
element.selectmenu( "refresh" );
98-
equal( button.text(), " Selected option", "button text after adding selected option" );
98+
equal( $.trim( button.text() ), "Selected option", "button text after adding selected option" );
9999

100100
start();
101101
} );

0 commit comments

Comments
 (0)