Selectmenu Tests: check if button text is updated when selected option is added

This commit is contained in:
Felix Nagel 2013-08-31 03:10:52 +02:00
parent 67f04e4e42
commit d668c94e3e

View File

@ -69,7 +69,7 @@ test( "refresh - structure", function () {
}); });
asyncTest( "refresh - change selected option", function () { asyncTest( "refresh - change selected option", function () {
expect( 3 ); expect( 4 );
var element = $( "#speed" ).selectmenu(), var element = $( "#speed" ).selectmenu(),
button = element.selectmenu( "widget" ); button = element.selectmenu( "widget" );
@ -83,9 +83,13 @@ asyncTest( "refresh - change selected option", function () {
element[ 0 ].selectedIndex = 0; element[ 0 ].selectedIndex = 0;
element.selectmenu( "refresh" ); element.selectmenu( "refresh" );
equal( element.find( "option:selected" ).text(), button.text(), "button text after changing selected option" ); equal( element.find( "option:selected" ).text(), button.text(), "button text after changing selected option" );
element.find( "option" ).removeAttr( "selected" );
element.prepend( "<option selected value=\"selected_option\">Selected option</option>" );
element.selectmenu( "refresh" );
equal( element.find( "option:selected" ).text(), button.text(), "button text after adding selected option" );
start(); start();
}, 1 ); }, 1 );
}); });