import * as React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { Button } from '../../Button';
import { Tabbable } from '../index';
import render from '../../utils/_tests/render';
describe('props', () => {
it('should render correctly', () => {
const { container } = render(
Tabbable
Disabled
Focusable
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('composition', () => {
describe('use', () => {
it('should render correctly', () => {
const { container } = render(
Tabbable
Disabled
Focusable
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('hook', () => {
it('should return with Tabbable props', () => {
const { result } = renderHook(() => {
return Tabbable.useProps({});
});
expect(result.current).toMatchSnapshot();
});
});
describe('render props', () => {
it('should render correctly', () => {
function Component() {
return {(tabbableProps) => Hello world
};
}
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
});
});
describe('overrides', () => {
it('Tabbable.base should render correctly', () => {
const { container } = render(
Tabbable
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('theming', () => {
it('Tabbable.base should render correctly', () => {
const { container } = render(Tabbable, {
theme: { Tabbable: { styles: { base: { backgroundColor: 'red' } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
});
describe('defaultProps', () => {
it('should render correctly for className', () => {
const { container } = render(Tabbable, {
theme: { Tabbable: { defaultProps: { className: 'test' } } },
});
expect(container.firstChild).toMatchSnapshot();
});
});