-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathpseudo-classes.test.tsx
More file actions
57 lines (49 loc) · 1.14 KB
/
pseudo-classes.test.tsx
File metadata and controls
57 lines (49 loc) · 1.14 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
50
51
52
53
54
55
56
57
import { act, fireEvent, render, screen } from "@testing-library/react-native";
import { View } from "react-native-css/components/View";
import { registerCSS, testID } from "react-native-css/jest";
const children = undefined;
test("hover", () => {
registerCSS(`
.text-color {
color: blue;
}
.text-color:hover {
color: red;
}
`);
render(<View testID={testID} className="text-color" />);
const component = screen.getByTestId(testID);
expect(component.props).toStrictEqual({
testID,
children,
onHoverIn: expect.any(Function),
onHoverOut: expect.any(Function),
style: {
color: "#00f",
},
});
act(() => {
fireEvent(component, "hoverIn");
});
expect(component.props).toStrictEqual({
testID,
children,
onHoverIn: expect.any(Function),
onHoverOut: expect.any(Function),
style: {
color: "#f00",
},
});
act(() => {
fireEvent(component, "hoverOut");
});
expect(component.props).toStrictEqual({
testID,
children,
onHoverIn: expect.any(Function),
onHoverOut: expect.any(Function),
style: {
color: "#00f",
},
});
});