From 6f1c6e02e3d6bd8dc833f1ba0cf470fba65069b5 Mon Sep 17 00:00:00 2001 From: conzett Date: Tue, 22 Nov 2011 20:25:41 -0500 Subject: [PATCH] Add tests for clicking on tab --- javascripts/tests/tests.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/javascripts/tests/tests.js b/javascripts/tests/tests.js index d2a6923..4f1f5d8 100644 --- a/javascripts/tests/tests.js +++ b/javascripts/tests/tests.js @@ -179,6 +179,42 @@ $(document).ready(function () { } }); - }); + }); + + test("Clicking tab changes panel", function () { + + var tabContainer = $('#qunit-fixture #tab-container'); + var tabList = $(tabContainer).find('> ul'); + var tabPanels = $(tabContainer).children().not('ul'); + tabContainer.skeletonTabs(); + var clickMe = $(tabContainer).find("ul li:nth-child(2)"); + + $(clickMe).click(); + + $(tabs).each(function(index) { + if(index != 1){ + equals($(this).attr('aria-selected'), + 'false', + 'Expect tab at position ' + index + ' to have aria-selected set to false after clicking tab at position 1'); + }else{ + equals($(this).attr('aria-selected'), + 'true', + 'Expect tab at position ' + index + ' to have aria-selected set to true since we clicked it'); + } + }); + + $(tabpanels).each(function(index) { + if(index != 1){ + equals($(this).attr('aria-hidden'), + 'true', + 'Expect tabpanel at position ' + index + ' to have aria-hidden set to true after clicking tab at position 1'); + }else{ + equals($(this).attr('aria-hidden'), + 'false', + 'Expect tabpanel at position ' + index + ' to have aria-hidden set to true since we clicked its tab'); + } + }); + + }); }); \ No newline at end of file