How to use jest-axe - 10 common examples

To help you get started, we’ve selected a few jest-axe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github primer / components / src / __tests__ / CircleBadge.js View on Github external
it("should have no axe violations", async () => {
    const {container} = HTMLRender()
    const results = await axe(container)
    expect(results).toHaveNoViolations()
    cleanup()
  })
github primer / components / src / __tests__ / TextInput.js View on Github external
it('should have no axe violations', async () => {
    const {container} = HTMLRender()
    const results = await axe(container)
    expect(results).toHaveNoViolations()
    cleanup()
  })
github veteransaffairscanada / vac-benefits-directory / __tests__ / pages / data-validation_tests.js View on Github external
it("passes axe tests", async () => {
    let html = mountedDataValidation().html();
    expect(await axe(html)).toHaveNoViolations();
  });
github twilio-labs / paste / packages / paste-core / components / list / __tests__ / index.spec.tsx View on Github external
it('should have no accessibility violations', async () => {
    const container = document.createElement('div');
    document.body.append(container);
    render(
      
        
          item
        
      ,
      container
    );
    const results = await axe(document.body);
    expect(results).toHaveNoViolations();
  });
github nexxtway / react-rainbow / src / components / RadioGroup / __test__ / radioGroup.a11y.spec.js View on Github external
it('should be accessible when both all options and the group have a label', async () => {
        expect.assertions(1);
        const html = ReactDOMServer.renderToString(
            ,
        );
        const results = await axe(html);
        expect(results).toHaveNoViolations();
    });
});
github nexxtway / react-rainbow / src / components / ProgressIndicator / __test__ / progressIndicator.a11y.spec.js View on Github external
it('should be accessible when label is passed', async () => {
        expect.assertions(1);
        const html = ReactDOMServer.renderToString(
            
                
                
                
                
                
            ,
        );
        const results = await axe(html);
        expect(results).toHaveNoViolations();
    });
    it('should be accessible when label is not passed', async () => {
github First-Peoples-Cultural-Council / fv-web-ui / frontend / app / assets / javascripts / views / pages / explore / dialect / Contributor / __tests__ / index.js View on Github external
test('Accessibility', async() => {
    const html = ReactDOMServer.renderToString()
    const results = await axe(html)
    expect(results).toHaveNoViolations()
  })
})
github primer / components / src / __tests__ / Tooltip.js View on Github external
it('should have no axe violations', async () => {
    const {container} = HTMLRender()
    const results = await axe(container)
    expect(results).toHaveNoViolations()
    cleanup()
  })
github DefinitelyTyped / DefinitelyTyped / types / jest-axe / jest-axe-tests.ts View on Github external
import { configureAxe, axe, toHaveNoViolations, JestAxe } from 'jest-axe';

expect.extend(toHaveNoViolations);

const newJestWithDefaults: JestAxe = configureAxe();

const newJestWithOptions: JestAxe = configureAxe({
    elementRef: false,
    iframes: false,
    rules: {},
    runOnly: {
        type: 'rules',
        values: [],
    },
    selectors: false,
});

const sameJest: JestAxe = axe;

expect('').toHaveNoViolations();
expect(document.body).toHaveNoViolations();
github DefinitelyTyped / DefinitelyTyped / types / jest-axe / jest-axe-tests.ts View on Github external
import { configureAxe, axe, toHaveNoViolations, JestAxe } from 'jest-axe';

expect.extend(toHaveNoViolations);

const newJestWithDefaults: JestAxe = configureAxe();

const newJestWithOptions: JestAxe = configureAxe({
    elementRef: false,
    iframes: false,
    rules: {},
    runOnly: {
        type: 'rules',
        values: [],
    },
    selectors: false,
});

const sameJest: JestAxe = axe;

expect('').toHaveNoViolations();
expect(document.body).toHaveNoViolations();

async () => {

jest-axe

Custom Jest matcher for aXe for testing accessibility

MIT
Latest version published 6 months ago

Package Health Score

75 / 100
Full package analysis

Popular jest-axe functions