Skip to content

Commit

Permalink
Tooltip tests: Added accessibility tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed May 22, 2012
1 parent cb70a5e commit 1339c18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/unit/tooltip/tooltip_core.js
Expand Up @@ -21,19 +21,24 @@ test( "markup structure", function() {
}); });


test( "accessibility", function() { test( "accessibility", function() {
// TODO: full tests expect( 5 );
expect( 2 );


var tooltipId, var tooltipId,
tooltip,
element = $( "#multiple-describedby" ).tooltip(); element = $( "#multiple-describedby" ).tooltip();


element.tooltip( "open" ); element.tooltip( "open" );
tooltipId = element.data( "ui-tooltip-id" ); tooltipId = element.data( "ui-tooltip-id" );
tooltip = $( "#" + tooltipId );
equal( tooltip.attr( "role" ), "tooltip", "role" );
equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId, equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId,
"multiple describedby when open" ); "multiple describedby when open" );
// strictEqual to distinguish between .removeAttr( "title" ) and .attr( "title", "" )
strictEqual( element.attr( "title" ), undefined, "no title when open" );
element.tooltip( "close" ); element.tooltip( "close" );
equal( element.attr( "aria-describedby" ), "fixture-span", equal( element.attr( "aria-describedby" ), "fixture-span",
"correct describedby when closed" ); "correct describedby when closed" );
equal( element.attr( "title" ), "...", "title restored when closed" );
}); });


}( jQuery ) ); }( jQuery ) );

0 comments on commit 1339c18

Please sign in to comment.