/
Radio-test.tsx
54 lines (51 loc) · 1.11 KB
/
Radio-test.tsx
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
50
51
52
53
54
import * as React from "react";
import { render } from "reakit-test-utils";
import { Radio, RadioProps } from "../Radio";
const props: RadioProps = {
value: "radio",
id: "radio",
items: [],
currentId: null,
registerItem: jest.fn(),
unregisterItem: jest.fn(),
setCurrentId: jest.fn(),
next: jest.fn(),
previous: jest.fn(),
first: jest.fn(),
last: jest.fn(),
up: jest.fn(),
down: jest.fn(),
};
test("render", () => {
const { baseElement } = render(<Radio {...props} />);
expect(baseElement).toMatchInlineSnapshot(`
<body>
<div>
<input
aria-checked="false"
id="radio"
tabindex="0"
type="radio"
value="radio"
/>
</div>
</body>
`);
});
test("render without state props", () => {
// @ts-ignore
const { baseElement } = render(<Radio id="radio" value="radio" />);
expect(baseElement).toMatchInlineSnapshot(`
<body>
<div>
<input
aria-checked="false"
id="radio"
tabindex="0"
type="radio"
value="radio"
/>
</div>
</body>
`);
});