Skip to content

Commit

Permalink
chore(24363): refactor violation callback
Browse files Browse the repository at this point in the history
  • Loading branch information
vanch3d committed Jul 17, 2024
1 parent acb9f1c commit 93bc54b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ import { ignoreGlobalRules } from '../a11y.ts'
import * as axe from 'axe-core'
import { Options } from 'cypress-axe'

const violationCallback = (violations: axe.Result[]) => {
for (const violation of violations) {
for (const node of violation.nodes) {
cy.log(violation.id, node.target, node.html)
}
}
}

export const checkAccessibility = (
context?: string | Node | axe.ContextObject | undefined,
options?: Options | undefined,
violationCallback?: ((violations: axe.Result[]) => void) | undefined,
skipFailures?: boolean
): void => {
const { rules, ...rest } = options || {}
Expand Down

0 comments on commit 93bc54b

Please sign in to comment.