Skip to content

Commit b044e06

Browse files
committed
test(tabs): added axe tree test for aria selected state
1 parent 5940f37 commit b044e06

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

elements/pf-tabs/test/pf-tabs.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ describe('<pf-tabs>', function() {
241241
expect(second).to.have.attribute('active');
242242
expect(third).to.not.have.attribute('active');
243243
});
244+
245+
it('should specify the selected tab to assistive technology', async function() {
246+
const snapshot = await a11ySnapshot();
247+
expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-2');
248+
});
244249
});
245250

246251
describe('pressing ArrowLeft', function() {
@@ -254,6 +259,12 @@ describe('<pf-tabs>', function() {
254259
expect(second).to.not.have.attribute('active');
255260
expect(third).to.have.attribute('active');
256261
});
262+
263+
it('should specify the selected tab to assistive technology', async function() {
264+
const snapshot = await a11ySnapshot();
265+
expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');
266+
});
267+
257268
describe('then pressing ArrowRight', function() {
258269
beforeEach(async function() {
259270
await sendKeys({ down: 'ArrowRight' });
@@ -267,6 +278,11 @@ describe('<pf-tabs>', function() {
267278
expect(second).to.not.have.attribute('active');
268279
expect(third).to.not.have.attribute('active');
269280
});
281+
282+
it('should specify the selected tab to assistive technology', async function() {
283+
const snapshot = await a11ySnapshot();
284+
expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-1');
285+
});
270286
});
271287
});
272288
});

0 commit comments

Comments
 (0)