Skip to content

Commit b09c7e8

Browse files
committed
Calendar tests: Add basic ARIA attribute tests
1 parent 27f9f87 commit b09c7e8

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/unit/calendar/core.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,4 +400,45 @@ QUnit.test( "mouse", function( assert ) {
400400
step1();
401401
} );
402402

403+
QUnit.test( "ARIA", function( assert ) {
404+
assert.expect( 15 );
405+
406+
var id = this.element.attr( "id" ),
407+
headerId = id + "-title",
408+
monthLabelId = id + "-month-label",
409+
table = this.element.find( "table" );
410+
411+
assert.equal( this.element.attr( "role" ), "region", "Role attribute" );
412+
assert.equal( this.element.attr( "aria-labelledby" ), headerId,
413+
"ARIA label attribute" );
414+
415+
assert.equal( this.element.find( "#" + headerId ).attr( "role" ), "header",
416+
"Header role attribute" );
417+
assert.equal( this.element.find( "#" + monthLabelId ).attr( "role" ), "alert",
418+
"Header month label role attribute" );
419+
420+
assert.equal( table.attr( "role" ), "grid", "Table role attribute" );
421+
assert.equal( table.attr( "aria-readonly" ), "true",
422+
"Table ARIA readonly attribute" );
423+
assert.equal( table.attr( "aria-labelledby" ), monthLabelId,
424+
"Table ARIA labelledby attribute" );
425+
assert.equal( table.attr( "tabindex" ), 0, "Table tabindex attribute" );
426+
427+
assert.equal( table.children( "thead" ).attr( "role" ), "presentation",
428+
"Table head role attribute" );
429+
assert.equal( table.find( "thead tr" ).attr( "role" ), "row",
430+
"Table head row role attribute" );
431+
assert.equal( table.find( "thead th" ).first().attr( "role" ), "columnheader",
432+
"Table head cell role attribute" );
433+
434+
assert.equal( table.children( "tbody" ).attr( "role" ), "presentation",
435+
"Table body role attribute" );
436+
assert.equal( table.find( "tbody tr" ).attr( "role" ), "row",
437+
"Table body row role attribute" );
438+
assert.equal( table.find( "tbody td" ).first().attr( "role" ), "gridcell",
439+
"Table body cell role attribute" );
440+
assert.equal( table.find( "tbody td" ).first().attr( "aria-describedby" ),
441+
monthLabelId, "Table body cell ARIA describedby attribute" );
442+
} );
443+
403444
} );

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy