Add tests for default tabpanel hidden states
This commit is contained in:
parent
8aa95004fc
commit
2cd63df1b7
@ -74,13 +74,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var activeClass = this.options.activeClass;
|
||||||
|
|
||||||
$(tabs).click(function() {
|
$(tabs).click(function() {
|
||||||
var controls = $(this).attr('aria-controls');
|
var controls = $(this).attr('aria-controls');
|
||||||
$(this).siblings().attr('aria-selected', 'false').removeClass(this.options.activeClass);
|
$(this).siblings().attr('aria-selected', 'false').removeClass(activeClass);
|
||||||
$(this).attr('aria-selected', 'true').addClass(this.options.activeClass);
|
$(this).attr('aria-selected', 'true').addClass(activeClass);
|
||||||
$(tabPanels).attr('aria-hidden', 'true').css('display', 'none').removeClass(this.options.activeClass);
|
$(tabPanels).attr('aria-hidden', 'true').css('display', 'none').removeClass(activeClass);
|
||||||
$(tabPanels).filter('#' + controls).attr('aria-hidden', 'false').css('display', 'block').addClass(this.options.activeClass);
|
$(tabPanels).filter('#' + controls).attr('aria-hidden', 'false').css('display', 'block').addClass(activeClass);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -225,4 +225,27 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Initialization should set display correctly", function () {
|
||||||
|
|
||||||
|
var tabContainer = $('#qunit-fixture #tab-container');
|
||||||
|
var tabList = $(tabContainer).find('> ul');
|
||||||
|
var tabPanels = $(tabContainer).children().not('ul');
|
||||||
|
var tabs = tabList.find('li');
|
||||||
|
tabContainer.skeletonTabs();
|
||||||
|
|
||||||
|
$(tabPanels).each(function(index) {
|
||||||
|
if(index != 0){
|
||||||
|
|
||||||
|
ok($(this).is(':hidden'),
|
||||||
|
'Expect tabpanel at position ' + index + ' to be hidden');
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
ok($(this).not(':hidden'),
|
||||||
|
'Expect tabpanel at position ' + index + ' to not be hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user