You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
2 years ago
|
import React from 'react';
|
||
|
import Radio, { Button, Group } from '..';
|
||
7 years ago
|
import focusTest from '../../../tests/shared/focusTest';
|
||
5 years ago
|
import mountTest from '../../../tests/shared/mountTest';
|
||
5 years ago
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||
8 years ago
|
|
||
2 years ago
|
import { render, fireEvent } from '../../../tests/utils';
|
||
|
|
||
8 years ago
|
describe('Radio', () => {
|
||
5 years ago
|
focusTest(Radio, { refFocus: true });
|
||
5 years ago
|
mountTest(Radio);
|
||
|
mountTest(Group);
|
||
|
mountTest(Button);
|
||
7 years ago
|
|
||
5 years ago
|
rtlTest(Radio);
|
||
|
rtlTest(Group);
|
||
|
rtlTest(Button);
|
||
|
|
||
8 years ago
|
it('should render correctly', () => {
|
||
2 years ago
|
const { container } = render(<Radio className="customized">Test</Radio>);
|
||
|
expect(container.firstChild).toMatchSnapshot();
|
||
8 years ago
|
});
|
||
|
|
||
8 years ago
|
it('responses hover events', () => {
|
||
|
const onMouseEnter = jest.fn();
|
||
|
const onMouseLeave = jest.fn();
|
||
|
|
||
2 years ago
|
const { container } = render(<Radio onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} />);
|
||
8 years ago
|
|
||
2 years ago
|
fireEvent.mouseEnter(container.querySelector('label')!);
|
||
8 years ago
|
expect(onMouseEnter).toHaveBeenCalled();
|
||
|
|
||
2 years ago
|
fireEvent.mouseLeave(container.querySelector('label')!);
|
||
8 years ago
|
expect(onMouseLeave).toHaveBeenCalled();
|
||
|
});
|
||
|
});
|