Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f1lt3r/ha11y
⭕ Browserless Parallelized Accessibility HTML Code Sniffer
https://github.com/f1lt3r/ha11y
accessibility accesssniff codesniffer ha11y html pa11y parallel
Last synced: 26 days ago
JSON representation
⭕ Browserless Parallelized Accessibility HTML Code Sniffer
- Host: GitHub
- URL: https://github.com/f1lt3r/ha11y
- Owner: F1LT3R
- License: mit
- Created: 2018-09-28T03:19:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-28T20:27:59.000Z (about 6 years ago)
- Last Synced: 2024-09-14T04:41:38.103Z (about 2 months ago)
- Topics: accessibility, accesssniff, codesniffer, ha11y, html, pa11y, parallel
- Language: HTML
- Homepage: http://f1lt3r.io
- Size: 406 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :o: ha11y
> Browserless Parallel Accessibility HTML Code Sniffer
[![Build Status](https://travis-ci.org/f1lt3r/ha11y.svg?branch=master)](https://travis-ci.org/f1lt3r/ha11y)
[![Coverage Status](https://coveralls.io/repos/github/f1lt3r/ha11y/badge.svg?branch=master)](https://coveralls.io/github/f1lt3r/ha11y?branch=master)
[![NPM Version](https://img.shields.io/npm/v/ha11y.svg)](https://www.npmjs.com/package/ha11y)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)## :man_scientist: Experimental
**:o: ha11y** is a highly experimental package. The API is subject to rapid change.
## Install
```
npm install --save-dev ha11y
```## Usage
### React
Test:
```js
import React from 'react';
import {shallow} from 'enzyme';
import ha11y from 'ha11y';import MyImgComp from '../MyImgComp';
it('ha11y test', () => {
const dom = (
Foo
{/* Oops... no ALT tag! */}
);const html = shallow(dom).html();
return ha11y.test(html)
.then(results => {
const errors = results.filter(result => result.heading === 'ERROR');
console.log(errors);
expect(errors.length).toEqual(0);
});
});
```Output:
```shell
FAIL src/comps/__tests__/MyImgComp.test.js
● Console
```
```json
[
{
"heading": "ERROR",
"issue": "WCAG2AAA.Principle1.Guideline1_1.1_1_1.H37",
"description": "Img element missing an alt attribute. Use the alt attribute to specify a short text alternative.",
"position": {
"lineNumber": 1,
"columnNumber": 0
},
"element": {
"node": "",
"class": "",
"id": ""
}
}
]
```## Licence
Runs on [HTML_CodeSniffer](https://squizlabs.github.io/HTML_CodeSniffer/) — see [licence.txt](HTML_CodeSniffer/licence.txt)