aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2014-04-08 11:19:26 -0400
committerScott González <scott.gonzalez@gmail.com>2014-04-18 12:37:06 -0400
commit1272fca9eff68de09c4d71b68a6de79c8baae276 (patch)
treeb736dbf55acae4dadad45e796939161b684c5b34 /tests/unit/selectmenu
parent184965598013c2387903f40372b010e27c531bf6 (diff)
downloadjquery-ui-1272fca9eff68de09c4d71b68a6de79c8baae276.tar.gz
jquery-ui-1272fca9eff68de09c4d71b68a6de79c8baae276.zip
Selectmenu: Don't use active items at all
Menus only use active items for nested menus which selectmenu doesn't support. Selectmenu should only be working with focused items. Ref gh-1224
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r--tests/unit/selectmenu/selectmenu_core.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js
index 551cda407..f499a429f 100644
--- a/tests/unit/selectmenu/selectmenu_core.js
+++ b/tests/unit/selectmenu/selectmenu_core.js
@@ -185,36 +185,36 @@ $.each([
});
asyncTest( "item focus and active state - " + settings.type, function () {
- expect( 8 );
+ expect( 4 );
- var element = $( settings.selector ).selectmenu(),
+ var items, focusedItem, activeItem,
+ element = $( settings.selector ).selectmenu(),
button = element.selectmenu( "widget" ),
- menu = element.selectmenu( "menuWidget" ),
- links, focusedItem, activeItem;
+ menu = element.selectmenu( "menuWidget" );
- // init menu
+ // Initialize menu
button.simulate( "focus" );
setTimeout(function() {
- links = menu.find( "li.ui-menu-item" );
+ items = menu.find( "li.ui-menu-item" );
button.trigger( "click" );
setTimeout(function() {
checkItemClasses();
- links.eq( 3 ).simulate( "mouseover" ).trigger( "click" );
+ items.eq( 3 ).simulate( "mouseover" ).trigger( "click" );
button.trigger( "click" );
- links.eq( 2 ).simulate( "mouseover" );
+ items.eq( 2 ).simulate( "mouseover" );
$( document ).trigger( "click" );
button.trigger( "click" );
- links.eq( 1 ).simulate( "mouseover" );
+ items.eq( 1 ).simulate( "mouseover" );
$( document ).trigger( "click" );
button.trigger( "click" );
setTimeout(function() {
- checkItemClasses();
+ checkItemClasses();
start();
}, 350 );
}, 350 );
@@ -223,11 +223,7 @@ $.each([
function checkItemClasses() {
focusedItem = menu.find( "li.ui-state-focus" );
equal( focusedItem.length, 1, "only one item has ui-state-focus class" );
- equal( focusedItem.attr( "id" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-focus class" );
-
- activeItem = menu.find( "li.ui-state-active" );
- equal( activeItem.length, 1, "only one item has ui-state-active class" );
- equal( activeItem.attr( "id" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-active class" );
+ equal( focusedItem.attr( "id" ), items.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-focus class" );
}
});