Irina Glushko 2389e7160b HW1 done | 3 years ago | |
---|---|---|
.. | ||
README.md | 3 years ago | |
karma.conf.js | 3 years ago | |
package.json | 3 years ago |
This example demonstrates how to use axe with the Mocha unit testing framework.
The unit test is in test/a11y.js
, and has two test cases: One that shows the
expected results from HTML with no errors, and one that shows the expected
result from HTML with a single error.
doc/examples/mocha
directorynpm install
to install dependenciesdoc/examples/mocha
directorynpm test
to run MochaYou should see output indicating that the tests ran successfully, with zero failures.
To run the example on your own HTML, such as widgets or controls, insert the
HTML into the document, retrieve the root element of your widget (with e.g.,
document.getElementById()
), and pass that as the first argument into a call
to axe.run
.
The third argument to the axe.run
call should be the function to test
the results. The example is simply looking at the count of violations, but much
more detailed information is available if desired. The axe documentation
should be consulted for more details on customizing and analyzing calls to
axe.run
.