chai-enzyme-axe
v1.0.2
Published
A chai assertion for enzyme and axe-core
Downloads
14
Readme
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)