aboutsummaryrefslogtreecommitdiff
path: root/integration/snapshots/styledcomponents-output.js
diff options
context:
space:
mode:
Diffstat (limited to 'integration/snapshots/styledcomponents-output.js')
-rw-r--r--integration/snapshots/styledcomponents-output.js31
1 files changed, 17 insertions, 14 deletions
diff --git a/integration/snapshots/styledcomponents-output.js b/integration/snapshots/styledcomponents-output.js
index 0f81a0ba7..b99d434da 100644
--- a/integration/snapshots/styledcomponents-output.js
+++ b/integration/snapshots/styledcomponents-output.js
@@ -40,18 +40,21 @@ const ErrorScreenRoot = styled.div`
`;
export function test() {
- const reactEl = document.createElement("div");
- document.body.appendChild(reactEl);
- ReactDOM.render(jsx(ErrorScreenRoot, {
- id: "error-el",
- children: "The react child should have this text"
- }, undefined, false, undefined, this), reactEl);
- const style = document.querySelector("style[data-styled]");
- console.assert(style, "style tag should exist");
- console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints");
- console.assert(document.querySelector("#error-el").textContent === "The react child should have this text");
- ReactDOM.unmountComponentAtNode(reactEl);
- reactEl.remove();
- style.remove();
- testDone(import.meta.url);
+ if (typeof window !== "undefined") {
+ const reactEl = document.createElement("div");
+ document.body.appendChild(reactEl);
+ ReactDOM.render(jsx(ErrorScreenRoot, {
+ id: "error-el",
+ children: "The react child should have this text"
+ }, undefined, false, undefined, this), reactEl);
+ const style = document.querySelector("style[data-styled]");
+ console.assert(style, "style tag should exist");
+ console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints");
+ console.assert(document.querySelector("#error-el").textContent === "The react child should have this text");
+ ReactDOM.unmountComponentAtNode(reactEl);
+ reactEl.remove();
+ style.remove();
+ return testDone(import.meta.url);
+ }
+ return testDone(import.meta.url);
}