import * as React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { Menu } from '../index';
import { Button } from '../../Button';
import { Link } from '../../Link';
import render from '../../utils/_tests/render';
describe('props', () => {
it('should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly for an invisible dropdown menu', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly for CSS props', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with groups', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with uncontrolled option groups', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with controlled option groups', () => {
const { container } = render(() => {
const [sortBy, setSortBy] = React.useState | string>('asc');
const [countries, setCountries] = React.useState | string>(['australia', 'india']);
return (
);
});
expect(container.firstChild).toMatchSnapshot();
});
});
describe('overrides', () => {
it('Menu.styles.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Divider.styles.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Group.styles.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Item.styles.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('theming', () => {
it('Menu.styles.base should render correctly', () => {
const { container } = render(
,
{
theme: { Menu: { styles: { base: { backgroundColor: 'red' } } } },
}
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Divider.styles.base should render correctly', () => {
const { container } = render(
,
{ theme: { Menu: { Divider: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Group.styles.base should render correctly', () => {
const { container } = render(
,
{ theme: { Menu: { Group: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Menu.Item.styles.base should render correctly', () => {
const { container } = render(
,
{ theme: { Menu: { Item: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('defaultProps', () => {
it('should render correctly for className', () => {
const { container } = render(
,
{
theme: { Menu: { defaultProps: { className: 'test', color: 'primary' } } },
}
);
expect(container.firstChild).toMatchSnapshot();
});
});