From 976b9b57bb0156767e6fd88b3adf746674a9f971 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Thu, 13 Nov 2008 15:51:09 +0000 Subject: Added accordion keyboard and ARIA support, and tests. Mozilla needs this for website. (partial review: Scott González, fix for 3553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/accordion.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/accordion.js b/tests/accordion.js index ff3719b41..6ede9bc06 100644 --- a/tests/accordion.js +++ b/tests/accordion.js @@ -129,4 +129,22 @@ test("accordionchange event, open closed and close again", function() { .accordion("activate", 0); }); +test("accessibility", function () { + expect(9); + var ac = $('#list1').accordion().accordion("activate", 1); + var headers = $(".ui-accordion-header"); + + equals( headers.eq(1).attr("tabindex"), "0", "active header should have tabindex=0"); + equals( headers.eq(0).attr("tabindex"), "-1", "inactive header should have tabindex=-1"); + equals( ac.attr("role"), "tablist", "main role"); + equals( headers.attr("role"), "tab", "tab roles"); + equals( headers.next().attr("role"), "tabpanel", "tabpanel roles"); + equals( headers.eq(1).attr("aria-expanded"), "true", "active tab has aria-expanded"); + equals( headers.eq(0).attr("aria-expanded"), "false", "inactive tab has aria-expanded"); + ac.accordion("activate", 0); + equals( headers.eq(0).attr("aria-expanded"), "true", "newly active tab has aria-expanded"); + equals( headers.eq(1).attr("aria-expanded"), "false", "newly inactive tab has aria-expanded"); +}); + + })(jQuery); -- cgit v1.2.3