Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions elements/pf-tabs/test/pf-tabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ describe('<pf-tabs>', function() {

beforeEach(updateComplete);

it('should show the first tab as selected in the accessibility tree', async function() {
const snapshot = await a11ySnapshot();
const tabs = snapshot.children?.filter(x => x.role === 'tab') ?? [];
const [first, ...rest] = tabs;
expect(first).to.have.property('selected', true);
for (const tab of rest) {
expect(tab).to.not.have.property('selected', true);
}
});

it('should apply aria attributes on initialization', function() {
const tabs = element.querySelectorAll('pf-tab');
const panels = element.querySelectorAll('pf-tab-panel');
Expand Down Expand Up @@ -121,6 +131,15 @@ describe('<pf-tabs>', function() {
it('should hide previously active panel', function() {
expect(element.querySelector('pf-tab-panel')).to.have.attribute('hidden');
});

it('should show the second tab as selected in the accessibility tree', async function() {
const snapshot = await a11ySnapshot();
const tabs = snapshot.children?.filter(x => x.role === 'tab') ?? [];
const [first, second, third] = tabs;
expect(first).to.not.have.property('selected', true);
expect(second).to.have.property('selected', true);
expect(third).to.not.have.property('selected', true);
});
});

describe('setting `activeIndex` to 2', function() {
Expand Down
Loading