-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathCheckbox.test.tsx
More file actions
49 lines (40 loc) · 1.39 KB
/
Checkbox.test.tsx
File metadata and controls
49 lines (40 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { render } from '@testing-library/react';
import { Checkbox, type ICheckbox } from './Checkbox';
describe('renderer/components/fields/Checkbox.tsx', () => {
const props: ICheckbox = {
name: 'appearance',
label: 'Appearance',
checked: true,
onChange: jest.fn(),
};
it('should render - visible', () => {
const tree = render(<Checkbox {...props} />);
expect(tree).toMatchSnapshot();
});
it('should render - not visible', () => {
const tree = render(<Checkbox visible={false} {...props} />);
expect(tree).toMatchSnapshot();
});
it('should render - disabled', () => {
const tree = render(<Checkbox disabled={true} {...props} />);
expect(tree).toMatchSnapshot();
});
it('should render - tooltip', () => {
const tree = render(
<Checkbox {...props} tooltip={<div>Hello world</div>} />,
);
expect(tree).toMatchSnapshot();
});
it('should render - positive counter unselected', () => {
const tree = render(<Checkbox {...props} checked={false} counter={5} />);
expect(tree).toMatchSnapshot();
});
it('should render - positive counter selected', () => {
const tree = render(<Checkbox {...props} checked={true} counter={5} />);
expect(tree).toMatchSnapshot();
});
it('should render - zero counter', () => {
const tree = render(<Checkbox {...props} counter={0} />);
expect(tree).toMatchSnapshot();
});
});