]> source.dussan.org Git - jquery-ui.git/commitdiff
Tests: Fix button space assertions on IE8 1619/head
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 17 Oct 2015 19:31:02 +0000 (15:31 -0400)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Sun, 25 Oct 2015 15:25:00 +0000 (11:25 -0400)
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
tests/unit/selectmenu/core.js
tests/unit/selectmenu/methods.js

index b12db5d33926fbd4561e30d493875e46bcbdaaa7..6d3a619bd65727a0ebbbab11b4d4dbec15b3e37b 100644 (file)
@@ -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 = $( "<div></div>" ).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 = $( "<div></div>" ).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 = $( "<div></div>" ).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();
 } );
index a6024fb9adffb16af8cc0d7362d904050032062d..689668e70edff3b308dc7fe2219985b6ae2980ae 100644 (file)
@@ -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();
                        } );
                } );
index 7007abe837d497ae7525c9b1a42e7337ada1f3b1..e8f2d2d37e2c4a22e6f2ea68ad09bfe7abfd3778 100644 (file)
@@ -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( "<option selected value=\"selected_option\">Selected option</option>" );
                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();
        } );