import { create } from 'react-test-renderer';
import Button from './Button';
import Icon from './Icon';
describe('', () => {
test('Custom color', () => {
const instance = create().root;
expect(instance.find((element: any) => element.type === 'div').props.className).toContain(
'transparent',
);
});
test('Disabled state', () => {
const instance = create().root;
const { className } = instance.find((element: any) => element.type === 'div').props;
expect(className).toContain('disabled');
expect(className).not.toContain('red');
});
test('iconEnd', () => {
const instance = create().root;
// eslint-disable-next-line testing-library/await-async-query -- Please fix the next time this file is touched!
expect(instance.findByType(Icon).props.icon).toBe('arrow-down');
});
it('iconStart', () => {
const instance = create(
,
).root;
expect(instance.find((element: any) => element.type === 'svg')).not.toBeNull();
});
test('Custom white text color on transparent background', () => {
const instance = create().root;
expect(
instance.findAll((element: any) => element.type === 'div')[1]?.props.className,
).toContain('inverse');
});
test('Default darkGray text color on transparent background', () => {
const instance = create().root;
expect(
instance.findAll((element: any) => element.type === 'div')[1]?.props.className,
).toContain('default');
});
test('accessibilityControls', () => {
const instance = create(
,
).root;
expect(
instance.find((element: any) => element.type === 'button').props['aria-controls'],
).toContain('another-element');
});
test('accessibilityExpanded', () => {
const instance = create().root;
expect(instance.find((element: any) => element.type === 'button').props['aria-expanded']).toBe(
true,
);
});
test('accessibilityHaspopup', () => {
const instance = create().root;
expect(instance.find((element: any) => element.type === 'button').props['aria-haspopup']).toBe(
true,
);
});
test('accessibilityLabel', () => {
const instance = create().root;
expect(
instance.find((element: any) => element.type === 'button').props['aria-label'],
).toContain('hello');
});
});