Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 38 additions & 25 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,22 @@ describe('tab-container', function () {
</div>
</tab-container>
`
tabContainer = document.querySelector('tab-container')
tabs = Array.from(document.querySelectorAll('button'))
panels = Array.from(document.querySelectorAll('[role="tabpanel"]'))
})

afterEach(function () {
afterEach(async function () {
// Check to make sure we still have accessible markup after the test finishes running.
expect(document.body).to.be.accessible()

document.body.innerHTML = ''
try {
await expect(tabContainer).to.be.accessible()
} finally {
document.body.innerHTML = ''
}
})

it('has accessible markup', function () {
expect(document.body).to.be.accessible()
return expect(tabContainer).to.be.accessible()
})

it('the second tab is still selected', function () {
Expand All @@ -126,19 +129,22 @@ describe('tab-container', function () {
</div>
</tab-container>
`
tabContainer = document.querySelector('tab-container')
tabs = Array.from(document.querySelectorAll('button'))
panels = Array.from(document.querySelectorAll('[role="tabpanel"]'))
})

afterEach(function () {
afterEach(async function () {
// Check to make sure we still have accessible markup after the test finishes running.
expect(document.body).to.be.accessible()

document.body.innerHTML = ''
try {
await expect(tabContainer).to.be.accessible()
} finally {
document.body.innerHTML = ''
}
})

it('has accessible markup', function () {
expect(document.body).to.be.accessible()
return expect(tabContainer).to.be.accessible()
})

it('the second tab is still selected', function () {
Expand Down Expand Up @@ -175,15 +181,17 @@ describe('tab-container', function () {
tabContainer.addEventListener('tab-container-changed', e => events.push(e))
})

afterEach(function () {
afterEach(async function () {
// Check to make sure we still have accessible markup after the test finishes running.
expect(document.body).to.be.accessible()

document.body.innerHTML = ''
try {
await expect(tabContainer).to.be.accessible()
} finally {
document.body.innerHTML = ''
}
})

it('has accessible markup', function () {
expect(document.body).to.be.accessible()
return expect(tabContainer).to.be.accessible()
})

it('click works and `tab-container-changed` event is dispatched with correct index', function () {
Expand Down Expand Up @@ -404,15 +412,17 @@ describe('tab-container', function () {
tabContainer.addEventListener('tab-container-changed', e => events.push(e))
})

afterEach(function () {
afterEach(async function () {
// Check to make sure we still have accessible markup after the test finishes running.
expect(document.body).to.be.accessible()

document.body.innerHTML = ''
try {
await expect(tabContainer).to.be.accessible()
} finally {
document.body.innerHTML = ''
}
})

it('has accessible markup', function () {
expect(document.body).to.be.accessible()
return expect(tabContainer).to.be.accessible()
})

it('only switches closest tab-containers on click', () => {
Expand Down Expand Up @@ -710,19 +720,22 @@ describe('tab-container', function () {
</div>
</tab-container>
`
tabContainer = document.querySelector('tab-container')
tabs = Array.from(document.querySelectorAll('button'))
panels = Array.from(document.querySelectorAll('[role="tabpanel"]'))
})

afterEach(function () {
afterEach(async function () {
// Check to make sure we still have accessible markup after the test finishes running.
expect(document.body).to.be.accessible()

document.body.innerHTML = ''
try {
await expect(tabContainer).to.be.accessible()
} finally {
document.body.innerHTML = ''
}
})

it('has accessible markup', function () {
expect(document.body).to.be.accessible()
return expect(tabContainer).to.be.accessible()
})

it('the second tab is still selected', function () {
Expand Down
Loading