diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-05-18 16:04:54 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-05-18 16:04:54 +0200 |
commit | 627d27fea23f1fb50db6c9ad8a2ff264505a0f3e (patch) | |
tree | a043e370ba54170b015401b6ad748e70fdbc101f /tests/unit/menu/menu_options.js | |
parent | 49b1a190b6a9ddd93789fe4ab9800193c38ec110 (diff) | |
download | jquery-ui-627d27fea23f1fb50db6c9ad8a2ff264505a0f3e.tar.gz jquery-ui-627d27fea23f1fb50db6c9ad8a2ff264505a0f3e.zip |
Menu: Tests for role option
Diffstat (limited to 'tests/unit/menu/menu_options.js')
-rw-r--r-- | tests/unit/menu/menu_options.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index e651fd2d1..306f575ea 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -38,4 +38,30 @@ test( "{ disabled: false }", function() { equal( $("#log").html(), "afterclick,1,click,", "Click order not valid."); }); +test("{ role: 'menu' } ", function () { + var menu = $('#menu1').menu(); + expect(2 + 5 * $("li", menu).length); + equal( menu.attr( "role" ), "menu" ); + ok( $("li", menu).length > 0, "number of menu items"); + $("li", menu).each(function(item) { + ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item"); + equal( $(this).attr("role"), "presentation", "menu item ("+ item + ") role"); + equal( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role"); + ok( $("a",this).hasClass("ui-corner-all"), "a element class for menu item ("+ item + ") "); + equal( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") "); + }); +}); + +test("{ role: 'listbox' } ", function () { + var menu = $('#menu1').menu({ + role: "listbox" + }); + expect(2 + $("li", menu).length); + equal( menu.attr( "role" ), "listbox" ); + ok( ($("li", menu).length > 0 ), "number of menu items"); + $("li", menu).each(function(item) { + equal( $("a", this).attr("role"), "option", "menu item ("+ item + ") role"); + }); +}); + })(jQuery); |