@roo-ui/components
Version:
53 lines (41 loc) • 1.24 kB
JavaScript
import React from 'react';
import { qantas as theme } from '@roo-ui/themes';
import { shallowWithTheme } from '@roo-ui/test-utils';
import { axe } from 'jest-axe';
import Button from '.';
describe('<Button />', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowWithTheme(<Button>Hello world</Button>, theme);
});
it('renders correctly', () => {
expect(wrapper).toMatchSnapshot();
});
it('has no accessibility errors', async () => {
expect(await axe(wrapper.html())).toHaveNoViolations();
});
describe('primary', () => {
beforeEach(() => {
wrapper = shallowWithTheme(<Button variant="primary">Hello world</Button>, theme);
});
it('renders correctly', () => {
expect(wrapper).toMatchSnapshot();
});
});
describe('rounded', () => {
beforeEach(() => {
wrapper = shallowWithTheme(<Button rounded>Hello world</Button>, theme);
});
it('renders correctly', () => {
expect(wrapper).toMatchSnapshot();
});
});
describe('block', () => {
beforeEach(() => {
wrapper = shallowWithTheme(<Button block>Hello world</Button>, theme);
});
it('renders correctly', () => {
expect(wrapper).toMatchSnapshot();
});
});
});