aboutsummaryrefslogtreecommitdiff
path: root/test/snippets/styledcomponents-output.js
blob: 91c87177051f77d68d6b235d6e2c9fc451b83352 (plain) (blame)
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
50
51
52
53
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() {
  if (typeof window !== "undefined") {
    const reactEl = document.createElement("div");
    document.body.appendChild(reactEl);
    ReactDOM.render(<ErrorScreenRoot id="error-el">The react child should have this text</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 === "The react child should have this text");

    ReactDOM.unmountComponentAtNode(reactEl);
    reactEl.remove();
    style.remove();
    return testDone(import.meta.url);
  }

  return testDone(import.meta.url);
}
mner 60-0/+120 2022-03-08rename _global -> bunGravatar Jarred Sumner 88-2476/+1719 2022-03-08[bun.js] Support logging `Headers`, `Response`, and `Request`Gravatar Jarred Sumner 4-72/+270 2022-03-08Fix https://github.com/Jarred-Sumner/bun/issues/122Gravatar Jarred Sumner 2-2/+16 2022-03-08Update sourcemap.zigGravatar Jarred Sumner 1-6/+6 2022-03-08[bun.js] WIP sourcemap supportGravatar Jarred Sumner 3-249/+646 2022-03-07Add VLQ bench, improve decodeVLQ perfGravatar Jarred Sumner 3-3/+138 2022-03-07Optimize sourcemapsGravatar Jarred Sumner 6-90/+210 2022-03-07Update options.zigGravatar Jarred Sumner 1-4/+37 2022-03-07source maps optimizationsGravatar Jarred Sumner 11-85/+458 2022-03-07[JS] Don't make this inlineGravatar Jarred Sumner 1-2/+2 2022-03-07[JS] Slight optimization for newlinesGravatar Jarred Sumner 1-36/+2 2022-03-07[JS Parser] Fix bug with decoding escape sequencesGravatar Jarred Sumner 1-4/+4 2022-03-07[JS/JSON] Optimize parsing long stringsGravatar Jarred Sumner 1-1/+37 2022-03-07[JS Parser] Add optimization for JSX spreadGravatar Jarred Sumner 1-0/+11 2022-03-061.7x faster sourcemap printingGravatar Jarred Sumner 1-24/+32 2022-03-06source maps work for app code in `bun dev`!Gravatar Jarred Sumner 19-153/+1098 2022-03-05[JS Parser] dot property shorthand for JSXGravatar Jarred Sumner 3-10/+82 2022-03-05Update README.mdGravatar Jarred Sumner 1-1/+1 2022-03-05Update README.mdGravatar Jarred Sumner 1-1/+1 2022-03-05Update README.mdGravatar Jarred Sumner 1-1/+12