Skip to content

Commit 0f621b7

Browse files
committed
Re-introduce accessibility tests
1 parent d4d48fd commit 0f621b7

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

test/test.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {assert} from '@open-wc/testing'
1+
import {assert, expect} from '@open-wc/testing'
22
import '../src/index.ts'
33

44
describe('tab-container', function () {
@@ -68,9 +68,16 @@ describe('tab-container', function () {
6868
})
6969

7070
afterEach(function () {
71+
// Check to make sure we still have accessible markup after the test finishes running.
72+
expect(document.body).to.be.accessible()
73+
7174
document.body.innerHTML = ''
7275
})
7376

77+
it('has accessible markup', function () {
78+
expect(document.body).to.be.accessible()
79+
})
80+
7481
it('the second tab is still selected', function () {
7582
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
7683
assert.deepStrictEqual(panels.map(isHidden), [true, false, true], 'Second panel is visible')
@@ -100,9 +107,16 @@ describe('tab-container', function () {
100107
})
101108

102109
afterEach(function () {
110+
// Check to make sure we still have accessible markup after the test finishes running.
111+
expect(document.body).to.be.accessible()
112+
103113
document.body.innerHTML = ''
104114
})
105115

116+
it('has accessible markup', function () {
117+
expect(document.body).to.be.accessible()
118+
})
119+
106120
it('the second tab is still selected', function () {
107121
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
108122
assert.deepStrictEqual(panels.map(isHidden), [true, false, true], 'Second panel is visible')
@@ -138,9 +152,16 @@ describe('tab-container', function () {
138152
})
139153

140154
afterEach(function () {
155+
// Check to make sure we still have accessible markup after the test finishes running.
156+
expect(document.body).to.be.accessible()
157+
141158
document.body.innerHTML = ''
142159
})
143160

161+
it('has accessible markup', function () {
162+
expect(document.body).to.be.accessible()
163+
})
164+
144165
it('click works and `tab-container-changed` event is dispatched', function () {
145166
tabs[1].click()
146167
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
@@ -331,9 +352,16 @@ describe('tab-container', function () {
331352
})
332353

333354
afterEach(function () {
355+
// Check to make sure we still have accessible markup after the test finishes running.
356+
expect(document.body).to.be.accessible()
357+
334358
document.body.innerHTML = ''
335359
})
336360

361+
it('has accessible markup', function () {
362+
expect(document.body).to.be.accessible()
363+
})
364+
337365
it('only switches closest tab-containers on click', () => {
338366
assert.deepStrictEqual(tabs.map(isSelected), [true, false, false])
339367
assert.deepStrictEqual(nestedTabs.map(isSelected), [true, false])

0 commit comments

Comments
 (0)