diff options
author | Felix Nagel <info@felixnagel.com> | 2013-05-30 22:30:56 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-05-30 22:30:56 +0200 |
commit | 1821517d8130c9e028da90a69dab4f7643073884 (patch) | |
tree | dab25c2b9fff5245b49d29783f078f091cc54e9e /tests/unit/selectmenu/selectmenu_methods.js | |
parent | 33317c937221db14e670001324bfd3471717817c (diff) | |
download | jquery-ui-1821517d8130c9e028da90a69dab4f7643073884.tar.gz jquery-ui-1821517d8130c9e028da90a69dab4f7643073884.zip |
Selectmenu Tests: use asyncTest when working with focus events
Diffstat (limited to 'tests/unit/selectmenu/selectmenu_methods.js')
-rw-r--r-- | tests/unit/selectmenu/selectmenu_methods.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/unit/selectmenu/selectmenu_methods.js b/tests/unit/selectmenu/selectmenu_methods.js index 96efa9a6a..05f2404d1 100644 --- a/tests/unit/selectmenu/selectmenu_methods.js +++ b/tests/unit/selectmenu/selectmenu_methods.js @@ -68,7 +68,7 @@ test( "refresh - structure", function () { equal( element.find( "option" ).first().text(), menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).first().text(), "changed item" ); }); -test( "refresh - change selected option", function () { +asyncTest( "refresh - change selected option", function () { expect( 3 ); var element = $( "#speed" ).selectmenu(), @@ -78,13 +78,16 @@ test( "refresh - change selected option", function () { button.simulate( "focus" ); - equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" ); + setTimeout(function() { + equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" ); - element.find( "option" ).eq( 2 ).removeAttr( "selected" ); - element.find( "option" ).eq( 0 ).attr( "selected", "selected" ); - element.selectmenu( "refresh" ); + element[ 0 ].selectedIndex = 0 + 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" ); + start(); + }, 1 ); }); |