From deee467c0ae2336622114f624bff8017fcb4a52f Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Wed, 15 Apr 2026 15:49:02 +0300 Subject: [PATCH] test(tabs): add axe tree test for selected state Closes #2771 Assisted-By: Claude Opus 4.6 (1M context) --- elements/pf-tabs/test/pf-tabs.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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() {