Skip to content
Permalink
Browse files

Selectmenu Tests: add item looping tests

  • Loading branch information
fnagel committed Jul 1, 2013
1 parent ff1bb14 commit 3483b9460bb8da116ad0d4aa19ee6f33b4134faa
Showing with 28 additions and 0 deletions.
  1. +28 −0 tests/unit/selectmenu/selectmenu_core.js
@@ -156,6 +156,34 @@ $.each([
}, 1 );
}, 1 );
});

asyncTest( "item looping - " + settings.type, function () {
expect( 2 );

var links,
element = $( settings.selector ).selectmenu(),
button = element.selectmenu( "widget" ),
menu = element.selectmenu( "menuWidget" ),
options = element.find( "option" );

// init menu
button.simulate( "focus" );

setTimeout(function() {
links = menu.find( "li.ui-menu-item a" );

button.trigger( "click" );
links.first().simulate( "mouseover" ).trigger( "click" );
button.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( element[ 0 ].selectedIndex, 0, "No looping beyond first item" );

button.trigger( "click" );
links.last().simulate( "mouseover" ).trigger( "click" );
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element[ 0 ].selectedIndex + 1, links.length, "No looping behind last item" );
start();
}, 1 );
});
});

})( jQuery );

0 comments on commit 3483b94

Please sign in to comment.
You can’t perform that action at this time.