-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScroll.test.mjs
48 lines (43 loc) · 1.28 KB
/
Scroll.test.mjs
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
// @ts-check
import React from "react";
import ReactDOMServer from "react-dom/server";
import assertSnapshot from "snapshot-assertion";
import Scroll from "./Scroll.mjs";
import assertBundleSize from "./test/assertBundleSize.mjs";
/**
* Adds `Scroll` tests.
* @param {import("test-director").default} tests Test director.
*/
export default (tests) => {
tests.add("`Scroll` bundle size.", async () => {
await assertBundleSize(new URL("./Scroll.mjs", import.meta.url), 300);
});
tests.add("`Scroll` without props.", async () => {
await assertSnapshot(
ReactDOMServer.renderToStaticMarkup(
React.createElement(
Scroll,
null,
React.createElement(
"tr",
null,
React.createElement("div", null, "Content.")
)
)
),
new URL("./test/snapshots/Scroll/without-props.html", import.meta.url)
);
});
tests.add("`Scroll` with props.", async () => {
await assertSnapshot(
ReactDOMServer.renderToStaticMarkup(
React.createElement(
Scroll,
{ className: "a", id: "b", ["data-c"]: "d" },
React.createElement("div", null, "Content.")
)
),
new URL("./test/snapshots/Scroll/with-props.html", import.meta.url)
);
});
};