aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-07-10 13:58:20 -0400
committerScott González <scott.gonzalez@gmail.com>2012-07-10 13:58:20 -0400
commit51c0878c41bf5880bfee58417c71727607c1d21f (patch)
treeb26cb0448416ad1bbb2cf64022286b1a5447eb4f /tests/unit/menu
parent566c5f40582effbb393e4890f2992c952702ab1d (diff)
downloadjquery-ui-51c0878c41bf5880bfee58417c71727607c1d21f.tar.gz
jquery-ui-51c0878c41bf5880bfee58417c71727607c1d21f.zip
Menu tests: More complete role option tests.
Diffstat (limited to 'tests/unit/menu')
-rw-r--r--tests/unit/menu/menu_options.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
index 27c2fabb3..a5df70026 100644
--- a/tests/unit/menu/menu_options.js
+++ b/tests/unit/menu/menu_options.js
@@ -40,7 +40,13 @@ test( "{ disabled: false }", function() {
equal( logOutput(), "click,1,afterclick", "Click order not valid." );
});
-test( "{ role: 'menu' } ", function () {
+// TODO: test icon option
+
+// TODO: test menus option
+
+// TODO: test position option
+
+test( "{ role: 'menu' } ", function() {
var element = $( "#menu1" ).menu(),
items = element.find( "li" );
expect( 2 + 5 * items.length );
@@ -55,16 +61,37 @@ test( "{ role: 'menu' } ", function () {
});
});
-test( "{ role: 'listbox' } ", function () {
+test( "{ role: 'listbox' } ", function() {
var element = $( "#menu1" ).menu({
role: "listbox"
}),
items = element.find( "li" );
- expect( 2 + items.length );
+ expect( 2 + 5 * items.length );
equal( element.attr( "role" ), "listbox" );
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" ), "presentation", "menu item ("+ item + ") role" );
equal( $( "a", this ).attr( "role" ), "option", "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: null }", function() {
+ var element = $( "#menu1" ).menu({
+ role: null
+ }),
+ items = element.find( "li" );
+ expect( 2 + 5 * items.length );
+ strictEqual( element.attr( "role" ), undefined );
+ 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" ), "presentation", "menu item ("+ item + ") role" );
+ equal( $( "a", this ).attr( "role" ), undefined, "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 + ")" );
});
});