How to use the jest-axe.axe function in jest-axe

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 noopkat / electric-io / public / js / components / specs / FormFields.spec.js View on Github external
test("Axe doesn’t find any violations", async () => {
    const wrapper = shallowMountComponent();
    const html = wrapper.html();

    expect(await axe(html)).toHaveNoViolations();
  });
});
github pluralsight / design-system / packages / emptystate / src / react / __specs__ / index.spec.js View on Github external
async function renderWithAxeResults(...args) {
  const { container, ...rest } = await render(...args)
  const axeResults = await axe(container.innerHTML)

  return { axeResults, container, ...rest }
}

jest-axe

Custom Jest matcher for aXe for testing accessibility

MIT
Latest version published 5 months ago

Package Health Score

75 / 100
Full package analysis

Popular jest-axe functions