From 3570cc5a2b2ec59fa1ccb4c78a58f526ca69918e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=CC=88rn=20Zaefferer?= Date: Sat, 17 Oct 2015 15:31:02 -0400 Subject: [PATCH] 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. --- tests/unit/dialog/options.js | 8 ++++---- tests/unit/selectmenu/core.js | 14 +++++++------- tests/unit/selectmenu/methods.js | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/unit/dialog/options.js b/tests/unit/dialog/options.js index b12db5d33..6d3a619bd 100644 --- a/tests/unit/dialog/options.js +++ b/tests/unit/dialog/options.js @@ -165,7 +165,7 @@ test( "buttons - advanced", function( assert ) { buttons = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); equal( buttons.length, 1, "correct number of buttons" ); equal( buttons.attr( "id" ), "my-button-id", "correct id" ); - equal( buttons.text().trim(), "a button", "correct label" ); + equal( $.trim( buttons.text() ), "a button", "correct label" ); assert.hasClasses( buttons, "additional-class" ); deepEqual( buttons.button( "option", "icon" ), "ui-icon-cancel" ); equal( buttons.button( "option", "showLabel" ), false ); @@ -209,17 +209,17 @@ test( "closeText", function() { expect( 3 ); var element = $( "
" ).dialog(); - equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "Close", + equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "Close", "default close text" ); element.remove(); element = $( "
" ).dialog( { closeText: "foo" } ); - equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "foo", + equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "foo", "closeText on init" ); element.remove(); element = $( "
" ).dialog().dialog( "option", "closeText", "bar" ); - equal( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text().trim(), "bar", + equal( $.trim( element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).text() ), "bar", "closeText via option method" ); element.remove(); } ); diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js index a6024fb9a..689668e70 100644 --- a/tests/unit/selectmenu/core.js +++ b/tests/unit/selectmenu/core.js @@ -89,8 +89,8 @@ test( "_renderButtonItem()", function() { element.selectmenu( "refresh" ); option = element.find( "option:selected" ); equal( - " " + option.text() + element[ 0 ].selectedIndex, - button.text(), + $.trim( button.text() ), + option.text() + element[ 0 ].selectedIndex, "refresh: button item text" ); @@ -98,8 +98,8 @@ test( "_renderButtonItem()", function() { menu.find( "li" ).last().simulate( "mouseover" ).trigger( "click" ); option = element.find( "option" ).last(); equal( - " " + option.text() + element[ 0 ].selectedIndex, - button.text(), + $.trim( button.text() ), + option.text() + element[ 0 ].selectedIndex, "click: button item text" ); } ); @@ -146,7 +146,7 @@ $.each( [ selected.val(), "original select state" ); - equal( button.text(), " " + selected.text(), "button text" ); + equal( $.trim( button.text() ), selected.text(), "button text" ); start(); } ); } ); @@ -181,7 +181,7 @@ $.each( [ selected.val(), "original select state" ); - equal( button.text(), " " + selected.text(), "button text" ); + equal( $.trim( button.text() ), selected.text(), "button text" ); start(); }, 1 ); } ); @@ -222,7 +222,7 @@ $.each( [ "button aria-activedescendant" ); equal( element.find( "option:selected" ).val(), options.eq( 1 ).val(), "original select state" ); - equal( button.text(), " " + options.eq( 1 ).text(), "button text" ); + equal( $.trim( button.text() ), options.eq( 1 ).text(), "button text" ); start(); } ); } ); diff --git a/tests/unit/selectmenu/methods.js b/tests/unit/selectmenu/methods.js index 7007abe83..e8f2d2d37 100644 --- a/tests/unit/selectmenu/methods.js +++ b/tests/unit/selectmenu/methods.js @@ -81,21 +81,21 @@ asyncTest( "refresh - change selected option", function() { var element = $( "#speed" ).selectmenu(), button = element.selectmenu( "widget" ); - equal( button.text(), " Medium", "button text after init" ); + equal( $.trim( button.text() ), "Medium", "button text after init" ); button.simulate( "focus" ); setTimeout( function() { - equal( button.text(), " Medium", "button text after focus" ); + equal( $.trim( button.text() ), "Medium", "button text after focus" ); element[ 0 ].selectedIndex = 0; element.selectmenu( "refresh" ); - equal( button.text(), " Slower", "button text after changing selected option" ); + equal( $.trim( button.text() ), "Slower", "button text after changing selected option" ); element.find( "option" ).prop( "selected", false ); element.append( "" ); element.selectmenu( "refresh" ); - equal( button.text(), " Selected option", "button text after adding selected option" ); + equal( $.trim( button.text() ), "Selected option", "button text after adding selected option" ); start(); } ); -- 2.39.5