Skip to content

Commit d9f0ac4

Browse files
committed
Create a basic in-browser test
1 parent c9f0e31 commit d9f0ac4

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tests/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="index.js" type="module" defer></script>
9+
</head>
10+
<body style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
11+
<p>Press <kbd>F12</kbd> to open the console.</p>
12+
</body>
13+
</html>

tests/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { cssToHtml } from '../dist/index.js';
2+
3+
const input = `
4+
:root {
5+
background: #000;
6+
}
7+
* {
8+
box-sizing: border-box;
9+
}
10+
a {
11+
border-radius: 10px;
12+
}
13+
button {
14+
background-color: red;
15+
}
16+
button:hover {
17+
background-color: blue;
18+
}
19+
@media screen and (max-width: 200px) {}
20+
#cat + .mouse >span.flea+i {
21+
padding: 10px;
22+
background-color: red;
23+
}
24+
nav a#logo.icon> img {
25+
display: block;
26+
}
27+
.pie .pastry.crenelations {
28+
background: radial-gradient(circle at center, orange 10%, yellow);
29+
}
30+
`;
31+
32+
const output = cssToHtml(input);
33+
34+
console.log('Input:');
35+
console.log(input);
36+
console.log('Output:');
37+
console.log(output);
38+

0 commit comments

Comments
 (0)