
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@advanced-rest-client/a11y-suite
Advanced tools
Performs accessibility test using axe-core.
It accepts a template string from which a fixture is created or already created element. The later option is useful to perform accessibility test for the element at certain state.
Rules can be ignored by providing configuration option which accepts array of rule names to ignore.
This is temporary package until
@open-wcimplement similar functionality in their testing package.
npm install --save-dev @advanced-rest-client/a11y-suite
import { a11ySuite } from '@advanced-rest-client/a11y-suite/index.js';
import { fixture } from '@open-wc/testing';
const fix = await fixture(`<div role="listbox">
<my-component>item</my-component>
</div>`);
describe('<my-component>', () => {
a11ySuite('Normal state', fix);
a11ySuite('Disabled state', `<div role="listbox"><my-component disabled>item</my-component></div>`);
a11ySuite('This passes error in axa', `<div aria-labelledby="non-existing-id"></div><label id="my-id">Title</label>`, ['badAriaAttributeValue']);
});
The test below passes even though it is invalid because the rule testing for valid aria attributes is disabled.
describe('<my-component>', () => {
await a11ySuite('Test Suite', '<div aria-labelledby="test-x"></div>', {
ignoredRules: ['aria-valid-attr-value']
});
});
You can change the state of the component by creating a fixture before passing it to the suite or by passing afterFixture callback function that is invoked when fixture is created but before the test is performed.
import { a11ySuite } from '@advanced-rest-client/a11y-suite/index.js';
import { fixture, aTimeout } from '@open-wc/testing';
describe('<my-component>', () => {
let element;
before(async () => {
element = await fixture(`<my-dialog>
<h1>Dialog</h1>
</my-dialog>`);
});
it('Passes a11y when opened', async () => {
element.opened = true;
async aTimeout();
await a11ySuite('Opened dialog', element);
});
});
If afterFixture returns a promise then the test is executed when the promise is resolved.
import { a11ySuite } from '@advanced-rest-client/a11y-suite/index.js';
import { fixture, aTimeout } from '@open-wc/testing';
describe('<my-component>', () => {
it('Passes a11y when opened', async () => {
await a11ySuite('Opened dialog', `<my-dialog><h1>Dialog</h1></my-dialog>`, {
afterFixture: async (element) => {
element.opened = true;
async aTimeout();
}
});
});
});
git clone https://github.com/advanced-rest-client/a11y-suite
cd a11y-suite
npm install
npm test
FAQs
a11y suite to test accessibility of web components
We found that @advanced-rest-client/a11y-suite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.