aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/menu/menu.html43
-rw-r--r--tests/unit/menu/menu_common.js1
-rw-r--r--tests/unit/menu/menu_events.js31
-rw-r--r--tests/visual/menu/menu.html9
4 files changed, 82 insertions, 2 deletions
diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html
index 7de175b3c..a49c72a04 100644
--- a/tests/unit/menu/menu.html
+++ b/tests/unit/menu/menu.html
@@ -255,6 +255,49 @@
<li class="foo">Saarland</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></li>
+ <li class="ui-menu-group"><strong>Group 2</strong></li>
+ <li>Delphi
+ <ul>
+ <li>Ada</li>
+ <li>Saarland</li>
+ <li>Salzburg</li>
+ </ul>
+ </li>
+ <li>Saarland</li>
+ <li>---</li>
+ <li class="ui-menu-group"><strong>Group 3</strong></li>
+ <li>Salzburg
+ <ul>
+ <li>Delphi
+ <ul>
+ <li>Ada</li>
+ <li> - </li>
+ <li>Saarland</li>
+ <li>&mdash;</li>
+ <li>Salzburg</li>
+ <li>&ndash;</li>
+ </ul>
+ </li>
+ <li>Delphi
+ <ul>
+ <li>Ada</li>
+ <li>Saarland</li>
+ <li>Salzburg</li>
+ </ul>
+ </li>
+ <li>Perch</li>
+ </ul>
+ </li>
+ <li>Amesville</li>
+</ul>
+
</div>
</body>
</html>
diff --git a/tests/unit/menu/menu_common.js b/tests/unit/menu/menu_common.js
index 4a89a947a..2404ebe02 100644
--- a/tests/unit/menu/menu_common.js
+++ b/tests/unit/menu/menu_common.js
@@ -4,6 +4,7 @@ TestHelpers.commonWidgetTests( "menu", {
icons: {
submenu: "ui-icon-carat-1-e"
},
+ items: "> *",
menus: "ul",
position: {
my: "left top",
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index 12bd5b703..0b89b86ac 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -577,6 +577,37 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite
}
});
+asyncTest( "handle keyboard navigation and mouse click on menu with dividers and group labels", function() {
+ expect( 2 );
+ var element = $( "#menu7" ).menu({
+ items: "> :not('.ui-menu-group')",
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).index());
+ }
+ });
+
+ log( "keydown", true );
+ element.one( "menufocus", function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ equal( logOutput(), "keydown,2,Ada", "Keydown skips initial group label" );
+ setTimeout( menukeyboard1, 50 );
+ });
+ element.focus();
+
+ function menukeyboard1() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,3,4,7", "Keydown focus skips divider and group label" );
+ start();
+ }
+});
+
asyncTest( "handle keyboard navigation with spelling of menu items", function() {
expect( 2 );
var element = $( "#menu2" ).menu({
diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html
index f25163d5f..1c203ef12 100644
--- a/tests/visual/menu/menu.html
+++ b/tests/visual/menu/menu.html
@@ -15,7 +15,7 @@
$( "<p>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
}
- $( "#menu1, #menu2, #menu3, .menu4, #menu7" ).menu({
+ $( "#menu1, #menu2, #menu3, .menu4" ).menu({
select: logger
});
@@ -29,6 +29,11 @@
select: logger,
icon: "ui-icon-carat-1-s"
});
+
+ $( "#menu7" ).menu({
+ items: "> :not('.ui-menu-group')",
+ select: logger
+ });
});
</script>
<style>
@@ -237,7 +242,7 @@
</div>
</div>
-<h2>Inline with dividers and elements without anchors</h2>
+<h2>Inline with dividers and group labels</h2>
<ul id="menu7">
<li class="ui-menu-group"><strong>Group 1</strong></li>
<li>Aberdeen</li>