diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2016-03-11 17:35:25 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2016-03-11 18:27:58 +0100 |
commit | 4866e14922217560f551b86ce80952c3e0f649da (patch) | |
tree | 56ec31670d0ac6b9bd0ca7a7ce263eaa0d73db1a /tests/unit | |
parent | 54cd4510ef955a5f50a4fc5aa91ccb85217e6a04 (diff) | |
download | jquery-ui-4866e14922217560f551b86ce80952c3e0f649da.tar.gz jquery-ui-4866e14922217560f551b86ce80952c3e0f649da.zip |
Menu: Remove active class from top-level item when menu is blurred
This issue was introduced by 0bbd1569182bc03e8dc4f5f8aa203e8edbe15f99,
which reduced the use of ui-state-focus and ui-state-active to using
only ui-state-focus. This introduced the issue addressed here.
The fix is more of a workaround. With test test in place, we can
investigate a better solution in the future.
Fixes #14919
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/menu/core.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/menu/core.js b/tests/unit/menu/core.js index a8e0ece00..200812f4e 100644 --- a/tests/unit/menu/core.js +++ b/tests/unit/menu/core.js @@ -73,4 +73,34 @@ asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected } ); } ); +asyncTest( "active menu item styling", function( assert ) { + expect( 5 ); + function isActive( item ) { + assert.hasClasses( item.children( ".ui-menu-item-wrapper" ), "ui-state-active" ); + } + function isInactive( item ) { + assert.lacksClasses( item.children( ".ui-menu-item-wrapper" ), "ui-state-active" ); + } + $.ui.menu.prototype.delay = 0; + var element = $( "#menu4" ).menu(); + var parentItem = element.children( "li:eq(1)" ); + var childItem = parentItem.find( "li:eq(0)" ); + element.menu( "focus", null, parentItem ); + setTimeout( function() { + isActive( parentItem ); + element.menu( "focus", null, childItem ); + setTimeout( function() { + isActive( parentItem ); + isActive( childItem ); + element.blur(); + setTimeout( function() { + isInactive( parentItem ); + isInactive( childItem ); + $.ui.menu.prototype.delay = 300; + start(); + }, 50 ); + } ); + } ); +} ); + } ); |