-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
49 lines (43 loc) · 1.16 KB
/
index.js
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 React from "react";
import Test from "./Test/Test";
import {
renderTestComponent,
clearDOM,
waitForTestComponentToHaveStyle,
changeRootSize,
waitForTestComponentToHaveCustomProperties,
waitForElementToHaveStyle
} from "../../utils";
// Features covered:
// Running the same tests as we do for the HoC version
describe("useContainerQuery", () => {
beforeAll(() => {
clearDOM();
renderTestComponent(<Test />, {
width: 100,
height: 50
});
});
it("should apply styles to the body", async () => {
await waitForElementToHaveStyle(document.body, {
backgroundColor: "rgb(200, 200, 200)"
});
});
it("should not have any of the container queries applied", async () => {
await waitForTestComponentToHaveStyle({
backgroundColor: "rgb(255, 0, 0)"
});
await waitForTestComponentToHaveCustomProperties({
"--w": "1px"
});
});
it("should react to width change", async () => {
changeRootSize({ width: 101 });
await waitForTestComponentToHaveStyle({
backgroundColor: "rgb(0, 255, 0)"
});
await waitForTestComponentToHaveCustomProperties({
"--w": "1.01px"
});
});
});