aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets/styledcomponents-output.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-25 02:06:06 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-25 02:06:06 -0700
commit20e2040e7e8cf2cd1ac2607f97fab8fd52193529 (patch)
tree784e858c5c050970bb0d1e7ca11e70f2d20ceb44 /integration/snippets/styledcomponents-output.js
parent538f73b2fa3a112111e6500a30f6a065914bd2f7 (diff)
downloadbun-v0.0.24.tar.gz
bun-v0.0.24.tar.zst
bun-v0.0.24.zip
Add integration test that checks styled-components renders successfully and no incorrect unicode characters are present in the `style` tagbun-v0.0.24
Diffstat (limited to 'integration/snippets/styledcomponents-output.js')
-rw-r--r--integration/snippets/styledcomponents-output.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/integration/snippets/styledcomponents-output.js b/integration/snippets/styledcomponents-output.js
new file mode 100644
index 000000000..898223c3e
--- /dev/null
+++ b/integration/snippets/styledcomponents-output.js
@@ -0,0 +1,58 @@
+import styled from "styled-components";
+import React from "react";
+import ReactDOM from "react-dom";
+
+const ErrorScreenRoot = styled.div`
+ font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial,
+ sans-serif;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ background: #fff;
+ text-align: center;
+ background-color: #0b2988;
+ color: #fff;
+ font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial,
+ sans-serif;
+ line-height: 1.5em;
+
+ & > p {
+ margin-top: 10px;
+ }
+
+ & a {
+ color: inherit;
+ }
+`;
+
+export function test() {
+ const reactEl = document.createElement("div");
+ document.body.appendChild(reactEl);
+ ReactDOM.render(
+ <ErrorScreenRoot id="error-el">
+ This is an error! Look for the string
+ </ErrorScreenRoot>,
+ 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 ===
+ "This is an error! Look for the string"
+ );
+
+ ReactDOM.unmountComponentAtNode(reactEl);
+ reactEl.remove();
+ testDone(import.meta.url);
+}