chai-enzyme-axe

1.0.2 • Public • Published

npm

chai-enzyme-axe

A chai assertion that runs axe-core on an enzyme wrapper object to test for a11y violations.

Installation

npm install chai-enzyme-axe

Follow the instructions on using axe-core.

Usage

import chai from 'chai'
import ChaiEnzymeAxe from 'chai-enzyme-axe'
 
chai.use(ChaiEnzymeAxe)
import {mount, render, shallow} from 'enzyme'
 
class Fixture extends React.Component {
  render () {
    return (
      <div>
        <label for="name">Name</label>
        <input type="text" id="name" />
      </div>
    )
  }
}
 
const wrapper = mount(<Fixture />)
 
wrapper.should.be.accessible(done)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i chai-enzyme-axe

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jstern