Skip to content

Commit

Permalink
chore: add config to jest_react example
Browse files Browse the repository at this point in the history
Closes #865
  • Loading branch information
Marcy Sutton committed May 1, 2018
1 parent cd846e9 commit c490835
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion doc/examples/jest_react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ axe-core in Jest (using JSDOM and Enzyme).
* `npm test` to run Jasmine

You should see output indicating that the tests ran successfully, with zero
failures.
failures.

Note: to work better with JSDOM (which has limited support for necessary DOM APIs),
the color-contrast and link-in-text-block rules have been disabled in this example.
You can test for these rules more reliably using full browser DOM integration
testing using [axe-webdriverjs](https://github.com/dequelabs/axe-webdriverjs).

## To modify the example ##

Expand Down
8 changes: 7 additions & 1 deletion doc/examples/jest_react/link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ test('Link has no aXe violations', (done) => {
);
const linkNode = linkComponent.getDOMNode();

axe.run(linkNode, (err, { violations }) => {
const config = {
"rules": {
"color-contrast": { enabled: false },
"link-in-text-block": { enabled: false }
}
}
axe.run(linkNode, config, (err, { violations }) => {
expect(err).toBe(null);
expect(violations).toHaveLength(0);
done();
Expand Down

0 comments on commit c490835

Please sign in to comment.