How to use @instructure/ui-axe-check - 3 common examples

To help you get started, we’ve selected a few @instructure/ui-axe-check examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instructure / instructure-ui / packages / ui-testbed / lib / enzymeWrapper.js View on Github external
ReactWrapper.prototype.getA11yViolations = function (done, options) {
  runAxeCheck(this.getDOMNode(), options).then((result) => {
    if (result instanceof Error) {
      done(result)
    } else {
      done()
    }
  }, done)
}
github instructure / instructure-ui / packages / ui-testbed / lib / chaiWrapper.js View on Github external
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!'))
      }
    })
  })
github instructure / instructure-ui / packages / ui-test-utils / src / utils / helpers.js View on Github external
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!')
  }
}

@instructure/ui-axe-check

A UI a11y testing library made by Instructure Inc.

MIT
Latest version published 6 days ago

Package Health Score

84 / 100
Full package analysis

Popular @instructure/ui-axe-check functions

Similar packages