Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ReactWrapper.prototype.getA11yViolations = function (done, options) {
runAxeCheck(this.getDOMNode(), options).then((result) => {
if (result instanceof Error) {
done(result)
} else {
done()
}
}, done)
}
utils.addMethod(chai.Assertion.prototype, 'accessible', function (done, options = {}) {
const obj = utils.flag(this, 'object')
let element = obj
if (typeof obj.getA11yViolations === 'function') {
obj.getA11yViolations(done, options)
} else if (obj instanceof Element) {
runAxeCheck(element, options).then((result) => {
if (result instanceof Error) {
done(result)
} else {
done()
}
}, done)
} else {
done(new Error('[ui-testbed] accessibility check can only run on a single DOM Element!'))
}
})
})
function accessible (element = document.body, options) {
if (isElement(element)) {
return runAxeCheck(element, options)
} else {
throw new Error('[ui-test-utils] accessibility check can only run on a single, valid DOM Element!')
}
}