imported the whole jquery-ui package, refreshed with 1.10.2
[unfold.git] / third-party / jquery-ui-1.10.2 / tests / unit / menu / menu_core.js
diff --git a/third-party/jquery-ui-1.10.2/tests/unit/menu/menu_core.js b/third-party/jquery-ui-1.10.2/tests/unit/menu/menu_core.js
new file mode 100644 (file)
index 0000000..5ee28c1
--- /dev/null
@@ -0,0 +1,30 @@
+(function( $ ) {
+
+module( "menu: core" );
+
+test( "markup structure", function() {
+       expect( 6 );
+       var element = $( "#menu1" ).menu();
+       ok( element.hasClass( "ui-menu" ), "main element is .ui-menu" );
+       element.children().each(function( index ) {
+               ok( $( this ).hasClass( "ui-menu-item" ), "child " + index + " is .ui-menu-item" );
+       });
+});
+
+test( "accessibility", function () {
+       expect( 4 );
+       var element = $( "#menu1" ).menu();
+
+       equal( element.attr( "role" ), "menu", "main role" );
+       ok( !element.attr( "aria-activedescendant" ), "aria-activedescendant not set" );
+
+       element.menu( "focus", $.Event(), element.children().eq( -2 ) );
+       equal( element.attr( "aria-activedescendant" ), "testID1", "aria-activedescendant from existing id" );
+
+       element.menu( "focus", $.Event(), element.children().eq( 0 ) );
+       ok( /^ui-id-\d+$/.test( element.attr( "aria-activedescendant" ) ), "aria-activedescendant from generated id" );
+
+       // Item roles are tested in the role option tests
+});
+
+})( jQuery );