-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextbox.test.mjs
41 lines (36 loc) · 1.16 KB
/
Textbox.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
// @ts-check
import React from "react";
import ReactDOMServer from "react-dom/server";
import assertSnapshot from "snapshot-assertion";
import assertBundleSize from "./test/assertBundleSize.mjs";
import Textbox from "./Textbox.mjs";
/**
* Adds `Textbox` tests.
* @param {import("test-director").default} tests Test director.
*/
export default (tests) => {
tests.add("`Textbox` bundle size.", async () => {
await assertBundleSize(new URL("./Textbox.mjs", import.meta.url), 550);
});
tests.add("`Textbox` without props.", async () => {
await assertSnapshot(
ReactDOMServer.renderToStaticMarkup(React.createElement(Textbox)),
new URL("./test/snapshots/Textbox/without-props.html", import.meta.url)
);
});
tests.add("`Textbox` with props.", async () => {
await assertSnapshot(
ReactDOMServer.renderToStaticMarkup(
React.createElement(Textbox, {
type: "email",
validationMessage: "Validation message.",
required: true,
className: "a",
id: "b",
["data-c"]: "d",
})
),
new URL("./test/snapshots/Textbox/with-props.html", import.meta.url)
);
});
};