Skip to content

Commit 1339c18

Browse files
committed
Tooltip tests: Added accessibility tests.
1 parent cb70a5e commit 1339c18

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/unit/tooltip/tooltip_core.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,24 @@ test( "markup structure", function() {
2121
});
2222

2323
test( "accessibility", function() {
24-
// TODO: full tests
25-
expect( 2 );
24+
expect( 5 );
2625

2726
var tooltipId,
27+
tooltip,
2828
element = $( "#multiple-describedby" ).tooltip();
2929

3030
element.tooltip( "open" );
3131
tooltipId = element.data( "ui-tooltip-id" );
32+
tooltip = $( "#" + tooltipId );
33+
equal( tooltip.attr( "role" ), "tooltip", "role" );
3234
equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId,
3335
"multiple describedby when open" );
36+
// strictEqual to distinguish between .removeAttr( "title" ) and .attr( "title", "" )
37+
strictEqual( element.attr( "title" ), undefined, "no title when open" );
3438
element.tooltip( "close" );
3539
equal( element.attr( "aria-describedby" ), "fixture-span",
3640
"correct describedby when closed" );
41+
equal( element.attr( "title" ), "...", "title restored when closed" );
3742
});
3843

3944
}( jQuery ) );

0 commit comments

Comments
 (0)