Dialog: Add missing unit test for aria-describedby attribute

This commit is contained in:
Jörn Zaefferer 2012-11-17 13:23:57 +01:00
parent 32a893128d
commit 5aac8f563f

View File

@ -17,24 +17,18 @@ test("title id", function() {
el.remove();
});
// TODO test for aria-describedby
// add only when the attribute isn't anywhere yet
test("ARIA", function() {
expect(4);
test( "ARIA", function() {
expect( 4 );
var labelledBy,
el = $('<div></div>').dialog();
equal(el.dialog('widget').attr('role'), 'dialog', 'dialog role');
labelledBy = el.dialog('widget').attr('aria-labelledby');
ok(labelledBy.length > 0, 'has aria-labelledby attribute');
equal(el.dialog('widget').find('.ui-dialog-title').attr('id'), labelledBy,
'proper aria-labelledby attribute');
equal(el.dialog('widget').find('.ui-dialog-titlebar-close').attr('role'), 'button',
'close link role');
var el = $( "<div></div>" ).dialog(),
wrapper = el.dialog( "widget" );
equal( wrapper.attr( "role" ), "dialog", "dialog role" );
equal( wrapper.attr( "aria-labelledby" ), wrapper.find( ".ui-dialog-title" ).attr( "id" ) );
equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" );
el.remove();
el = $( '<div><div aria-describedby="section2"><p id="section2">descriotion</p></div></div>' ).dialog();
strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" );
el.remove();
});