aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu
diff options
context:
space:
mode:
authorTJ VanToll <tj.vantoll@gmail.com>2014-10-25 09:18:17 -0700
committerTJ VanToll <tj.vantoll@gmail.com>2014-10-25 10:10:30 -0700
commitde2ef2a585447cf75fc8d4a734c12aa2bbd028c2 (patch)
tree38f5491fedb4668ff8a55ea38934bf7f5561d777 /tests/unit/menu
parent3002d460de2b854243d99634e69d394dfca78886 (diff)
downloadjquery-ui-de2ef2a585447cf75fc8d4a734c12aa2bbd028c2.tar.gz
jquery-ui-de2ef2a585447cf75fc8d4a734c12aa2bbd028c2.zip
Menu: Wrap menu items in a <div>
This avoids styling issues where ui-state-focus rules apply to submenus. Fixes #10162 Closes gh-1342
Diffstat (limited to 'tests/unit/menu')
-rw-r--r--tests/unit/menu/menu.html397
-rw-r--r--tests/unit/menu/menu_common.js2
-rw-r--r--tests/unit/menu/menu_core.js7
-rw-r--r--tests/unit/menu/menu_events.js24
-rw-r--r--tests/unit/menu/menu_methods.js5
-rw-r--r--tests/unit/menu/menu_options.js18
-rw-r--r--tests/unit/menu/menu_test_helpers.js4
7 files changed, 244 insertions, 213 deletions
diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html
index cb3df5b00..56115c334 100644
--- a/tests/unit/menu/menu.html
+++ b/tests/unit/menu/menu.html
@@ -33,7 +33,7 @@
font-size: 15px;
line-height: 15px;
}
- .ui-menu .ui-menu-item {
+ .ui-menu .ui-menu-item-wrapper {
padding: 0;
}
#menu3 {
@@ -52,263 +52,284 @@
<div id="qunit-fixture">
<ul class="foo" id="menu1">
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li id="testID1" class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div id="testID1">Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
</ul>
<ul id="menu2">
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo"><span class="ui-icon ui-icon-print"></span>Addyston</li>
- <li>Delphi
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo">
+ <div><span class="ui-icon ui-icon-print"></span>Addyston</div>
+ </li>
+ <li>
+ <div>Delphi</div>
<ul>
- <li class="foo">Ada</li>
- <li class="foo">Saarland</li>
- <li class="foo">Salzburg</li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Saarland</div></li>
+ <li class="foo"><div>Salzburg</div></li>
</ul>
</li>
- <li class="foo"> Saarland</li>
- <li>Salzburg
+ <li class="foo"><div> Saarland</div></li>
+ <li>
+ <div>Salzburg</div>
<ul>
- <li>Delphi
+ <li>
+ <div>Delphi</div>
<ul>
- <li class="foo">Ada</li>
- <li class="foo">Saarland</li>
- <li class="foo">Salzburg</li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Saarland</div></li>
+ <li class="foo"><div>Salzburg</div></li>
</ul>
</li>
- <li>Delphi
+ <li>
+ <div>Delphi</div>
<ul>
- <li class="foo">Ada</li>
+ <li class="foo"><div>Ada</div></li>
<li> - </li>
- <li class="foo">Saarland</li>
+ <li class="foo"><div>Saarland</div></li>
<li></li>
- <li class="foo">Salzburg</li>
+ <li class="foo"><div>Salzburg</div></li>
<li>&ndash;</li>
</ul>
</li>
- <li class="foo">Perch</li>
+ <li class="foo"><div>Perch</div></li>
</ul>
</li>
</ul>
<ul class="foo" id="menu3">
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
- <li class="foo">Alexandria</li>
- <li class="foo">Alger</li>
- <li class="foo">Alledonia</li>
- <li class="foo">Alliance</li>
- <li class="foo">Alpha</li>
- <li class="foo">Alvada</li>
- <li class="foo">Alvordton</li>
- <li class="foo">Amanda</li>
- <li class="foo">Amelia</li>
- <li class="foo">Amesville</li>
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
- <li class="foo">Alexandria</li>
- <li class="foo">Alger</li>
- <li class="foo">Alledonia</li>
- <li class="foo">Alliance</li>
- <li class="foo">Alpha</li>
- <li class="foo">Alvada</li>
- <li class="foo">Alvordton</li>
- <li class="foo">Amanda</li>
- <li class="foo">Amelia</li>
- <li class="foo">Amesville</li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
+ <li class="foo"><div>Alexandria</div></li>
+ <li class="foo"><div>Alger</div></li>
+ <li class="foo"><div>Alledonia</div></li>
+ <li class="foo"><div>Alliance</div></li>
+ <li class="foo"><div>Alpha</div></li>
+ <li class="foo"><div>Alvada</div></li>
+ <li class="foo"><div>Alvordton</div></li>
+ <li class="foo"><div>Amanda</div></li>
+ <li class="foo"><div>Amelia</div></li>
+ <li class="foo"><div>Amesville</div></li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
+ <li class="foo"><div>Alexandria</div></li>
+ <li class="foo"><div>Alger</div></li>
+ <li class="foo"><div>Alledonia</div></li>
+ <li class="foo"><div>Alliance</div></li>
+ <li class="foo"><div>Alpha</div></li>
+ <li class="foo"><div>Alvada</div></li>
+ <li class="foo"><div>Alvordton</div></li>
+ <li class="foo"><div>Amanda</div></li>
+ <li class="foo"><div>Amelia</div></li>
+ <li class="foo"><div>Amesville</div></li>
</ul>
<ul class="foo" id="menu4">
- <li class="foo">Aberdeen</li>
+ <li class="foo"><div>Aberdeen</div></li>
<li class="foo">
- Ada
+ <div>Ada</div>
<ul class="foo">
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
- <li class="foo">Alexandria</li>
- <li class="foo">Alger</li>
- <li class="foo">Alledonia</li>
- <li class="foo">Alliance</li>
- <li class="foo">Alpha</li>
- <li class="foo">Alvada</li>
- <li class="foo">Alvordton</li>
- <li class="foo">Amanda</li>
- <li class="foo">Amelia</li>
- <li class="foo">Amesville</li>
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
+ <li class="foo"><div>Alexandria</div></li>
+ <li class="foo"><div>Alger</div></li>
+ <li class="foo"><div>Alledonia</div></li>
+ <li class="foo"><div>Alliance</div></li>
+ <li class="foo"><div>Alpha</div></li>
+ <li class="foo"><div>Alvada</div></li>
+ <li class="foo"><div>Alvordton</div></li>
+ <li class="foo"><div>Amanda</div></li>
+ <li class="foo"><div>Amelia</div></li>
+ <li class="foo"><div>Amesville</div></li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
</ul>
</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
- <li class="foo">Alexandria</li>
- <li class="foo">Alger</li>
- <li class="foo">Alledonia</li>
- <li class="foo">Alliance</li>
- <li class="foo">Alpha</li>
- <li class="foo">Alvada</li>
- <li class="foo">Alvordton</li>
- <li class="foo">Amanda</li>
- <li class="foo">Amelia</li>
- <li class="foo">Amesville</li>
- <li class="foo">Aberdeen</li>
- <li class="foo">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li class="foo">Adelphi</li>
- <li class="foo">Adena</li>
- <li class="foo">Adrian</li>
- <li class="foo">Akron</li>
- <li class="foo">Albany</li>
- <li class="foo">Alexandria</li>
- <li class="foo">Alger</li>
- <li class="foo">Alledonia</li>
- <li class="foo">Alliance</li>
- <li class="foo">Alpha</li>
- <li class="foo">Alvada</li>
- <li class="foo">Alvordton</li>
- <li class="foo">Amanda</li>
- <li class="foo">Amelia</li>
- <li class="foo">Amesville</li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
+ <li class="foo"><div>Alexandria</div></li>
+ <li class="foo"><div>Alger</div></li>
+ <li class="foo"><div>Alledonia</div></li>
+ <li class="foo"><div>Alliance</div></li>
+ <li class="foo"><div>Alpha</div></li>
+ <li class="foo"><div>Alvada</div></li>
+ <li class="foo"><div>Alvordton</div></li>
+ <li class="foo"><div>Amanda</div></li>
+ <li class="foo"><div>Amelia</div></li>
+ <li class="foo"><div>Amesville</div></li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li class="foo"><div>Adelphi</div></li>
+ <li class="foo"><div>Adena</div></li>
+ <li class="foo"><div>Adrian</div></li>
+ <li class="foo"><div>Akron</div></li>
+ <li class="foo"><div>Albany</div></li>
+ <li class="foo"><div>Alexandria</div></li>
+ <li class="foo"><div>Alger</div></li>
+ <li class="foo"><div>Alledonia</div></li>
+ <li class="foo"><div>Alliance</div></li>
+ <li class="foo"><div>Alpha</div></li>
+ <li class="foo"><div>Alvada</div></li>
+ <li class="foo"><div>Alvordton</div></li>
+ <li class="foo"><div>Amanda</div></li>
+ <li class="foo"><div>Amelia</div></li>
+ <li class="foo"><div>Amesville</div></li>
</ul>
<div id="menu5">
- <blockquote>Aberdeen</blockquote>
- <blockquote>Ada</blockquote>
- <blockquote>Adamsville</blockquote>
- <blockquote>Addyston</blockquote>
- <blockquote>Delphi
- <div>
- <blockquote>Ada</blockquote>
- <blockquote>Saarland</blockquote>
- <blockquote>Salzburg</blockquote>
+ <blockquote><div>Aberdeen</div></blockquote>
+ <blockquote><div>Ada</div></blockquote>
+ <blockquote><div>Adamsville</div></blockquote>
+ <blockquote><div>Addyston</div></blockquote>
+ <blockquote>
+ <div>Delphi</div>
+ <div class="menu">
+ <blockquote><div>Ada</div></blockquote>
+ <blockquote><div>Saarland</div></blockquote>
+ <blockquote><div>Salzburg</div></blockquote>
</div>
</blockquote>
- <blockquote>Saarland</blockquote>
- <blockquote>Salzburg
- <div>
- <blockquote>Delphi
- <div>
- <blockquote>Ada</blockquote>
+ <blockquote><div>Saarland</div></blockquote>
+ <blockquote>
+ <div>Salzburg</div>
+ <div class="menu">
+ <blockquote>
+ <div>Delphi</div>
+ <div class="menu">
+ <blockquote><div>Ada</div></blockquote>
<blockquote id="testID2">Saarland</blockquote>
- <blockquote>Salzburg</blockquote>
+ <blockquote><div>Salzburg</div></blockquote>
</div>
</blockquote>
- <blockquote>Delphi
- <div>
- <blockquote>Ada</blockquote>
- <blockquote>Saarland</blockquote>
- <blockquote>Salzburg</blockquote>
+ <blockquote>
+ <div>Delphi</div>
+ <div class="menu">
+ <blockquote><div>Ada</div></blockquote>
+ <blockquote><div>Saarland</div></blockquote>
+ <blockquote><div>Salzburg</div></blockquote>
</div>
</blockquote>
- <blockquote>Perch</blockquote>
+ <blockquote><div>Perch</div></blockquote>
</div>
</blockquote>
</div>
<ul id="menu6">
- <li class="foo">Aberdeen</li>
- <li class="foo ui-state-disabled">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
- <li id="testID3" class="ui-state-disabled">Delphi
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo ui-state-disabled"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
+ <li id="testID3" class="ui-state-disabled">
+ <div>Delphi</div>
<ul>
- <li class="foo">Ada</li>
- <li class="foo">Saarland</li>
- <li class="foo">Salzburg</li>
+ <li class="foo"><div>Ada</div></li>
+ <li class="foo"><div>Saarland</div></li>
+ <li class="foo"><div>Salzburg</div></li>
</ul>
</li>
- <li class="foo">Saarland</li>
+ <li class="foo"><div>Saarland</div></li>
</ul>
<ul id="menu7">
- <li class="ui-menu-group"><strong>Group 1</strong></li>
- <li>Aberdeen</li>
- <li>Ada</li>
- <li>Adamsville</li>
- <li>Addyston</li>
+ <li class="ui-menu-group">
+ <div><strong>Group 1</strong></div>
+ </li>
+ <li><div>Aberdeen</div></li>
+ <li><div>Ada</div></li>
+ <li><div>Adamsville</div></li>
+ <li><div>Addyston</div></li>
<li></li>
- <li class="ui-menu-group"><strong>Group 2</strong></li>
- <li>Delphi
+ <li class="ui-menu-group">
+ <div><strong>Group 2</strong></div>
+ </li>
+ <li>
+ <div>Delphi</div>
<ul>
- <li>Ada</li>
- <li>Saarland</li>
- <li>Salzburg</li>
+ <li><div>Ada</div></li>
+ <li><div>Saarland</div></li>
+ <li><div>Salzburg</div></li>
</ul>
</li>
- <li>Saarland</li>
+ <li><div>Saarland</div></li>
<li>---</li>
- <li class="ui-menu-group"><strong>Group 3</strong></li>
- <li>Salzburg
+ <li class="ui-menu-group">
+ <div><strong>Group 3</strong></div>
+ </li>
+ <li>
+ <div>Salzburg</div>
<ul>
- <li>Delphi
+ <li>
+ <div>Delphi</div>
<ul>
- <li>Ada</li>
+ <li><div>Ada</div></li>
<li> - </li>
- <li>Saarland</li>
+ <li><div>Saarland</div></li>
<li>&mdash;</li>
- <li>Salzburg</li>
+ <li><div>Salzburg</div></li>
<li>&ndash;</li>
</ul>
</li>
- <li>Delphi
+ <li>
+ <div>Delphi</div>
<ul>
- <li>Ada</li>
- <li>Saarland</li>
- <li>Salzburg</li>
+ <li><div>Ada</div></li>
+ <li><div>Saarland</div></li>
+ <li><div>Salzburg</div></li>
</ul>
</li>
- <li>Perch</li>
+ <li><div>Perch</div></li>
</ul>
</li>
- <li>Amesville</li>
+ <li><div>Amesville</div></li>
</ul>
<ul id="menu8">
- <li class="foo">Aberdeen</li>
- <li class="foo ui-state-disabled">Ada</li>
- <li class="foo">Adamsville</li>
- <li class="foo">Addyston</li>
+ <li class="foo"><div>Aberdeen</div></li>
+ <li class="foo ui-state-disabled"><div>Ada</div></li>
+ <li class="foo"><div>Adamsville</div></li>
+ <li class="foo"><div>Addyston</div></li>
<li class="foo">-</li>
- <li class="foo">-Saarland</li>
+ <li class="foo"><div>-Saarland</div></li>
</ul>
</div>
diff --git a/tests/unit/menu/menu_common.js b/tests/unit/menu/menu_common.js
index 099dd091e..2404ebe02 100644
--- a/tests/unit/menu/menu_common.js
+++ b/tests/unit/menu/menu_common.js
@@ -7,7 +7,7 @@ TestHelpers.commonWidgetTests( "menu", {
items: "> *",
menus: "ul",
position: {
- my: "left-1 top",
+ my: "left top",
at: "right top"
},
role: "menu",
diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js
index df039c9e4..f02f97fca 100644
--- a/tests/unit/menu/menu_core.js
+++ b/tests/unit/menu/menu_core.js
@@ -48,12 +48,13 @@ asyncTest( "#9044: Autofocus issue with dialog opened from menu widget", functio
asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected item for Selectmenu", function() {
expect( 1 );
var element = $( "#menu1" ).menu(),
- firstChild = element.children().eq( 0 );
+ firstChild = element.children().eq( 0 ),
+ wrapper = firstChild.children( ".ui-menu-item-wrapper" );
element.menu( "focus", null, firstChild );
- firstChild.addClass( "ui-state-active" );
+ wrapper.addClass( "ui-state-active" );
setTimeout( function() {
- ok( firstChild.is( ".ui-state-active" ), "ui-state-active improperly removed" );
+ ok( wrapper.is( ".ui-state-active" ), "ui-state-active improperly removed" );
start();
}, 500 );
});
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index 02e63bf63..f4d494f47 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -32,7 +32,7 @@ test( "handle click on custom item menu", function() {
select: function() {
log();
},
- menus: "div"
+ menus: ".menu"
});
log( "click", true );
click( element, "1" );
@@ -91,7 +91,7 @@ asyncTest( "handle focus of menu with active item", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index() );
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -142,12 +142,12 @@ asyncTest( "handle submenu auto collapse: mouseleave", function() {
asyncTest( "handle submenu auto collapse: mouseleave", function() {
expect( 4 );
- var element = $( "#menu5" ).menu({ menus: "div" }),
+ var element = $( "#menu5" ).menu({ menus: ".menu" }),
event = $.Event( "mouseenter" );
function menumouseleave1() {
equal( element.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
- element.menu( "focus", event, element.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ) );
+ element.menu( "focus", event, element.find( ":nth-child(7)" ).find( ".menu" ).eq( 0 ).children().eq( 0 ) );
setTimeout( menumouseleave2, 350 );
}
function menumouseleave2() {
@@ -177,7 +177,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and without submen
log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index() );
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -243,7 +243,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus"
log( $( ui.item[0] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index() );
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -363,7 +363,7 @@ asyncTest( "handle keyboard navigation on menu with scroll and without submenus"
log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index());
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -438,7 +438,7 @@ asyncTest( "handle keyboard navigation on menu with scroll and with submenus", f
log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index());
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
@@ -533,7 +533,7 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite
log( $( ui.item[0] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index());
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
@@ -585,7 +585,7 @@ asyncTest( "handle keyboard navigation and mouse click on menu with dividers and
log( $( ui.item[0] ).text() );
},
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index());
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -612,7 +612,7 @@ asyncTest( "handle keyboard navigation with spelling of menu items", function()
expect( 3 );
var element = $( "#menu2" ).menu({
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index() );
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -635,7 +635,7 @@ asyncTest( "Keep focus on selected item (see #10644)", function() {
expect( 1 );
var element = $( "#menu2" ).menu({
focus: function( event ) {
- log( $( event.target ).find( ".ui-state-focus" ).index() );
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
index 5a633998d..ef8279018 100644
--- a/tests/unit/menu/menu_methods.js
+++ b/tests/unit/menu/menu_methods.js
@@ -73,11 +73,12 @@ test( "refresh icons (see #9377)", function() {
expect( 3 );
var element = $( "#menu1" ).menu();
ok( !element.hasClass( "ui-menu-icons") );
- element.find( "li:first" ).html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" );
+ element.find( "li:first .ui-menu-item-wrapper" )
+ .html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" );
element.menu( "refresh" );
ok( element.hasClass( "ui-menu-icons" ) );
- element.find( "li:first" ).html( "Save" );
+ element.find( "li:first .ui-menu-item-wrapper" ).html( "Save" );
element.menu( "refresh" );
ok( !element.hasClass( "ui-menu-icons" ) );
});
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
index c76673345..438b02a32 100644
--- a/tests/unit/menu/menu_options.js
+++ b/tests/unit/menu/menu_options.js
@@ -71,8 +71,10 @@ test( "{ role: 'menu' } ", function() {
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
- equal( $( this ).attr( "role" ), "menuitem", "menu item ("+ item + ") role" );
- equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "role" ),
+ "menuitem", "menu item ("+ item + ") role" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "tabindex" ), "-1",
+ "tabindex for menu item ("+ item + ")" );
});
});
@@ -86,8 +88,10 @@ test( "{ role: 'listbox' } ", function() {
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
- equal( $( this ).attr( "role" ), "option", "menu item ("+ item + ") role" );
- equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "role" ), "option",
+ "menu item ("+ item + ") role" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "tabindex" ), "-1",
+ "tabindex for menu item ("+ item + ")" );
});
});
@@ -101,8 +105,10 @@ test( "{ role: null }", function() {
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
- equal( $( this ).attr( "role" ), undefined, "menu item ("+ item + ") role" );
- equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "role" ), undefined,
+ "menu item ("+ item + ") role" );
+ equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "tabindex" ), "-1",
+ "tabindex for menu item ("+ item + ")" );
});
});
diff --git a/tests/unit/menu/menu_test_helpers.js b/tests/unit/menu/menu_test_helpers.js
index 77737c390..ea273c765 100644
--- a/tests/unit/menu/menu_test_helpers.js
+++ b/tests/unit/menu/menu_test_helpers.js
@@ -24,7 +24,9 @@ TestHelpers.menu = {
click: function( menu, item ) {
lastItem = item;
- menu.children( ":eq(" + item + ")" ).trigger( "click" );
+ menu.children( ":eq(" + item + ")" )
+ .children( ".ui-menu-item-wrapper" )
+ .trigger( "click" );
}
};