Add tests for clicking on tab
This commit is contained in:
parent
12627f5e39
commit
6f1c6e02e3
@ -181,4 +181,40 @@ $(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');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user