Re-introduce accessibility tests
This commit is contained in:
Родитель
d4d48fdc02
Коммит
0f621b7813
30
test/test.js
30
test/test.js
|
@ -1,4 +1,4 @@
|
|||
import {assert} from '@open-wc/testing'
|
||||
import {assert, expect} from '@open-wc/testing'
|
||||
import '../src/index.ts'
|
||||
|
||||
describe('tab-container', function () {
|
||||
|
@ -68,9 +68,16 @@ describe('tab-container', function () {
|
|||
})
|
||||
|
||||
afterEach(function () {
|
||||
// Check to make sure we still have accessible markup after the test finishes running.
|
||||
expect(document.body).to.be.accessible()
|
||||
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('has accessible markup', function () {
|
||||
expect(document.body).to.be.accessible()
|
||||
})
|
||||
|
||||
it('the second tab is still selected', function () {
|
||||
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
|
||||
assert.deepStrictEqual(panels.map(isHidden), [true, false, true], 'Second panel is visible')
|
||||
|
@ -100,9 +107,16 @@ describe('tab-container', function () {
|
|||
})
|
||||
|
||||
afterEach(function () {
|
||||
// Check to make sure we still have accessible markup after the test finishes running.
|
||||
expect(document.body).to.be.accessible()
|
||||
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('has accessible markup', function () {
|
||||
expect(document.body).to.be.accessible()
|
||||
})
|
||||
|
||||
it('the second tab is still selected', function () {
|
||||
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
|
||||
assert.deepStrictEqual(panels.map(isHidden), [true, false, true], 'Second panel is visible')
|
||||
|
@ -138,9 +152,16 @@ describe('tab-container', function () {
|
|||
})
|
||||
|
||||
afterEach(function () {
|
||||
// Check to make sure we still have accessible markup after the test finishes running.
|
||||
expect(document.body).to.be.accessible()
|
||||
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('has accessible markup', function () {
|
||||
expect(document.body).to.be.accessible()
|
||||
})
|
||||
|
||||
it('click works and `tab-container-changed` event is dispatched', function () {
|
||||
tabs[1].click()
|
||||
assert.deepStrictEqual(tabs.map(isSelected), [false, true, false], 'Second tab is selected')
|
||||
|
@ -331,9 +352,16 @@ describe('tab-container', function () {
|
|||
})
|
||||
|
||||
afterEach(function () {
|
||||
// Check to make sure we still have accessible markup after the test finishes running.
|
||||
expect(document.body).to.be.accessible()
|
||||
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('has accessible markup', function () {
|
||||
expect(document.body).to.be.accessible()
|
||||
})
|
||||
|
||||
it('only switches closest tab-containers on click', () => {
|
||||
assert.deepStrictEqual(tabs.map(isSelected), [true, false, false])
|
||||
assert.deepStrictEqual(nestedTabs.map(isSelected), [true, false])
|
||||
|
|
Загрузка…
Ссылка в новой задаче