Skip to content

Commit

Permalink
test: improve accessibilty assertion by using find-by-part
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Apr 12, 2022
1 parent 331be61 commit d0793a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cypress/integration/accordion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("accordion", () => {

describe("given a single accordion", () => {
it("should have no accessibility violation", () => {
cy.checkA11y("[data-part=root]")
cy.findByPart("root").then(cy.checkA11y)
})

describe("when navigating by keyboard", () => {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("accordion", () => {
})

it("should have no accessibility violations", () => {
cy.checkA11y(".accordion")
cy.findByPart("root").then(cy.checkA11y)
})

it("then clicking the same trigger again: should not close the content", () => {
Expand All @@ -80,7 +80,7 @@ describe("accordion", () => {
})

it("should have no accessibility violations", () => {
cy.checkA11y(".accordion")
cy.findByPart("root").then(cy.checkA11y)
})

describe("when navigating by keyboard", () => {
Expand Down Expand Up @@ -119,7 +119,7 @@ describe("accordion", () => {
})

it("should have no accessibility violations", () => {
cy.checkA11y(".accordion")
cy.findByPart("root").then(cy.checkA11y)
})

it("then clicking the same trigger again: should hide the content", () => {
Expand Down

0 comments on commit d0793a4

Please sign in to comment.