aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2017-03-31 21:51:08 +0200
committerFelix Nagel <info@felixnagel.com>2017-03-31 21:51:08 +0200
commitb09c7e8cee760a622031232442b6c751e3698d19 (patch)
treeba3472740e21d0269c7e4d2bc1149857f50ead90
parent27f9f87fa25202777b36d7a9c199733a9d25d61c (diff)
downloadjquery-ui-b09c7e8cee760a622031232442b6c751e3698d19.tar.gz
jquery-ui-b09c7e8cee760a622031232442b6c751e3698d19.zip
Calendar tests: Add basic ARIA attribute tests
-rw-r--r--tests/unit/calendar/core.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/calendar/core.js b/tests/unit/calendar/core.js
index e165ec681..e6dfab092 100644
--- a/tests/unit/calendar/core.js
+++ b/tests/unit/calendar/core.js
@@ -400,4 +400,45 @@ QUnit.test( "mouse", function( assert ) {
step1();
} );
+QUnit.test( "ARIA", function( assert ) {
+ assert.expect( 15 );
+
+ var id = this.element.attr( "id" ),
+ headerId = id + "-title",
+ monthLabelId = id + "-month-label",
+ table = this.element.find( "table" );
+
+ assert.equal( this.element.attr( "role" ), "region", "Role attribute" );
+ assert.equal( this.element.attr( "aria-labelledby" ), headerId,
+ "ARIA label attribute" );
+
+ assert.equal( this.element.find( "#" + headerId ).attr( "role" ), "header",
+ "Header role attribute" );
+ assert.equal( this.element.find( "#" + monthLabelId ).attr( "role" ), "alert",
+ "Header month label role attribute" );
+
+ assert.equal( table.attr( "role" ), "grid", "Table role attribute" );
+ assert.equal( table.attr( "aria-readonly" ), "true",
+ "Table ARIA readonly attribute" );
+ assert.equal( table.attr( "aria-labelledby" ), monthLabelId,
+ "Table ARIA labelledby attribute" );
+ assert.equal( table.attr( "tabindex" ), 0, "Table tabindex attribute" );
+
+ assert.equal( table.children( "thead" ).attr( "role" ), "presentation",
+ "Table head role attribute" );
+ assert.equal( table.find( "thead tr" ).attr( "role" ), "row",
+ "Table head row role attribute" );
+ assert.equal( table.find( "thead th" ).first().attr( "role" ), "columnheader",
+ "Table head cell role attribute" );
+
+ assert.equal( table.children( "tbody" ).attr( "role" ), "presentation",
+ "Table body role attribute" );
+ assert.equal( table.find( "tbody tr" ).attr( "role" ), "row",
+ "Table body row role attribute" );
+ assert.equal( table.find( "tbody td" ).first().attr( "role" ), "gridcell",
+ "Table body cell role attribute" );
+ assert.equal( table.find( "tbody td" ).first().attr( "aria-describedby" ),
+ monthLabelId, "Table body cell ARIA describedby attribute" );
+} );
+
} );