diff --git a/elements/pf-tabs/test/pf-tabs.spec.ts b/elements/pf-tabs/test/pf-tabs.spec.ts index 419f3b28cd..8e012a0e5b 100644 --- a/elements/pf-tabs/test/pf-tabs.spec.ts +++ b/elements/pf-tabs/test/pf-tabs.spec.ts @@ -52,6 +52,16 @@ describe('', 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'); @@ -121,6 +131,15 @@ describe('', 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() {