1 |
(function( $ ) { |
2 |
|
3 |
module( "menu: core" ); |
4 |
|
5 |
test( "markup structure", function() { |
6 |
expect( 6 ); |
7 |
var element = $( "#menu1" ).menu(); |
8 |
ok( element.hasClass( "ui-menu" ), "main element is .ui-menu" ); |
9 |
element.children().each(function( index ) { |
10 |
ok( $( this ).hasClass( "ui-menu-item" ), "child " + index + " is .ui-menu-item" ); |
11 |
}); |
12 |
}); |
13 |
|
14 |
test( "accessibility", function () { |
15 |
expect( 4 ); |
16 |
var element = $( "#menu1" ).menu(); |
17 |
|
18 |
equal( element.attr( "role" ), "menu", "main role" ); |
19 |
ok( !element.attr( "aria-activedescendant" ), "aria-activedescendant not set" ); |
20 |
|
21 |
element.menu( "focus", $.Event(), element.children().eq( -2 ) ); |
22 |
equal( element.attr( "aria-activedescendant" ), "testID1", "aria-activedescendant from existing id" ); |
23 |
|
24 |
element.menu( "focus", $.Event(), element.children().eq( 0 ) ); |
25 |
ok( /^ui-id-\d+$/.test( element.attr( "aria-activedescendant" ) ), "aria-activedescendant from generated id" ); |
26 |
|
27 |
// Item roles are tested in the role option tests |
28 |
}); |
29 |
|
30 |
})( jQuery ); |