mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
809cc0f8d0
commit
979373983b
@ -3,15 +3,21 @@
|
|||||||
module( "selectmenu: core" );
|
module( "selectmenu: core" );
|
||||||
|
|
||||||
asyncTest( "accessibility", function() {
|
asyncTest( "accessibility", function() {
|
||||||
var wrappers,
|
var wrappers, button, menu,
|
||||||
element = $( "#speed" ).selectmenu(),
|
element = $( "#speed" ).attr( "title", "A demo title" );
|
||||||
button = element.selectmenu( "widget" ),
|
|
||||||
|
element.find( "option" ).each(function( index ) {
|
||||||
|
$( this ).attr( "title", "A demo title #" + index );
|
||||||
|
});
|
||||||
|
|
||||||
|
element.selectmenu();
|
||||||
|
button = element.selectmenu( "widget" );
|
||||||
menu = element.selectmenu( "menuWidget" );
|
menu = element.selectmenu( "menuWidget" );
|
||||||
|
|
||||||
button.simulate( "focus" );
|
button.simulate( "focus" );
|
||||||
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
|
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
|
||||||
|
|
||||||
expect( 12 + wrappers.length * 2 );
|
expect( 13 + wrappers.length * 3 );
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
equal( button.attr( "role" ), "combobox", "button role" );
|
equal( button.attr( "role" ), "combobox", "button role" );
|
||||||
@ -25,6 +31,7 @@ asyncTest( "accessibility", function() {
|
|||||||
"button link aria-labelledby"
|
"button link aria-labelledby"
|
||||||
);
|
);
|
||||||
equal( button.attr( "tabindex" ), 0, "button link tabindex" );
|
equal( button.attr( "tabindex" ), 0, "button link tabindex" );
|
||||||
|
equal( button.attr( "title" ), "A demo title", "button title" );
|
||||||
|
|
||||||
equal( menu.attr( "role" ), "listbox", "menu role" );
|
equal( menu.attr( "role" ), "listbox", "menu role" );
|
||||||
equal( menu.attr( "aria-labelledby" ), button.attr( "id" ), "menu aria-labelledby" );
|
equal( menu.attr( "aria-labelledby" ), button.attr( "id" ), "menu aria-labelledby" );
|
||||||
@ -36,9 +43,10 @@ asyncTest( "accessibility", function() {
|
|||||||
"menu aria-activedescendant"
|
"menu aria-activedescendant"
|
||||||
);
|
);
|
||||||
$.each( wrappers, function( index ) {
|
$.each( wrappers, function( index ) {
|
||||||
var link = $( this );
|
var item = $( this );
|
||||||
equal( link.attr( "role" ), "option", "menu link #" + index +" role" );
|
equal( item.attr( "role" ), "option", "menu item #" + index +" role" );
|
||||||
equal( link.attr( "tabindex" ), -1, "menu link #" + index +" tabindex" );
|
equal( item.attr( "tabindex" ), -1, "menu item #" + index +" tabindex" );
|
||||||
|
equal( item.attr( "title" ), "A demo title #" + index, "menu item #" + index + " title" );
|
||||||
});
|
});
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,8 @@ return $.widget( "ui.selectmenu", {
|
|||||||
"aria-expanded": "false",
|
"aria-expanded": "false",
|
||||||
"aria-autocomplete": "list",
|
"aria-autocomplete": "list",
|
||||||
"aria-owns": this.ids.menu,
|
"aria-owns": this.ids.menu,
|
||||||
"aria-haspopup": "true"
|
"aria-haspopup": "true",
|
||||||
|
title: this.element.attr( "title" )
|
||||||
})
|
})
|
||||||
.insertAfter( this.element );
|
.insertAfter( this.element );
|
||||||
|
|
||||||
@ -317,7 +318,9 @@ return $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
_renderItem: function( ul, item ) {
|
_renderItem: function( ul, item ) {
|
||||||
var li = $( "<li>" ),
|
var li = $( "<li>" ),
|
||||||
wrapper = $( "<div>" );
|
wrapper = $( "<div>", {
|
||||||
|
title: item.element.attr( "title" )
|
||||||
|
});
|
||||||
|
|
||||||
if ( item.disabled ) {
|
if ( item.disabled ) {
|
||||||
li.addClass( "ui-state-disabled" );
|
li.addClass( "ui-state-disabled" );
|
||||||
|
Loading…
Reference in New Issue
Block a user