diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2015-04-08 16:09:17 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2015-04-08 16:34:26 +0200 |
commit | c770605db05347edfa9c6224aebd42974092ed22 (patch) | |
tree | 30b5150da4ff957bbc62956b5ad3ded734be65eb /tests/unit/menu/menu_events.js | |
parent | 2d0f05b25dfd308f306ffb2fe1e42380b3b3daa7 (diff) | |
download | jquery-ui-c770605db05347edfa9c6224aebd42974092ed22.tar.gz jquery-ui-c770605db05347edfa9c6224aebd42974092ed22.zip |
Menu: Ignore bubbled mouseenter events on parent items
Test uses QUnit 2.x API - inconsistent with the other tests, but also
a good reference.
Fixes #11641
Closes gh-1535
Diffstat (limited to 'tests/unit/menu/menu_events.js')
-rw-r--r-- | tests/unit/menu/menu_events.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 4985e0677..bda2d6050 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -111,6 +111,48 @@ asyncTest( "handle focus of menu with active item", function() { }); }); +test( "handle mouseenter on nested menu item", function( assert ) { + assert.expect( 8 ); + $.ui.menu.prototype.delay = 1; + var activeItem, + done = assert.async(), + element = $( "#menu2" ).menu(); + + element + .menu( "previous" ) + .menu( "expand" ); + + function checkSubmenus() { + equal( element.find( "ul[aria-expanded='true']" ).length, 2, "both submenus expanded" ); + } + function menumouseenter1() { + element.menu( "expand" ); + setTimeout( menumouseenter2, 25 ); + } + function menumouseenter2() { + checkSubmenus(); + activeItem = $( "#" + element.attr( "aria-activedescendant" ) ); + assert.hasClasses( activeItem, "ui-state-active" ); + activeItem.trigger( "mouseleave" ); + setTimeout( menumouseenter3, 25 ); + } + function menumouseenter3() { + checkSubmenus(); + assert.lacksClasses( activeItem, "ui-state-active" ); + activeItem.trigger( "mouseenter" ); + setTimeout( menumouseenter4, 25 ); + } + function menumouseenter4() { + checkSubmenus(); + activeItem.parents( ".ui-menu-item" ).each( function( index, item ) { + assert.hasClasses( $( item ).children( ".ui-menu-item-wrapper" ), "ui-state-active" ); + } ); + $.ui.menu.prototype.delay = 300; + done(); + } + setTimeout( menumouseenter1, 25 ); +} ); + asyncTest( "handle submenu auto collapse: mouseleave, default markup", function() { expect( 4 ); $.ui.menu.prototype.delay = 1; |