-
Notifications
You must be signed in to change notification settings - Fork 59
/
resolveStaticStyleRules.test.ts
50 lines (47 loc) · 1.16 KB
/
resolveStaticStyleRules.test.ts
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
import { resolveStaticStyleRules } from './resolveStaticStyleRules';
describe('resolveStaticStyleRules', () => {
it('handles font-face', () => {
expect(
resolveStaticStyleRules([
{
'@font-face': {
fontFamily: 'Open Sans',
src: `url("webfont.woff2") format("woff2")`,
},
},
]),
).toMatchInlineSnapshot(`
Array [
"@font-face{font-family:Open Sans;src:url(\\"webfont.woff2\\") format(\\"woff2\\");}",
]
`);
});
it('handles static css', () => {
expect(
resolveStaticStyleRules([
{
body: {
background: 'blue',
},
'.foo': {
background: 'yellow',
marginLeft: '5px',
},
},
]),
).toMatchInlineSnapshot(`
Array [
"body{background:blue;}",
".foo{background:yellow;margin-left:5px;}",
]
`);
});
it('handles css string', () => {
expect(resolveStaticStyleRules(['body {background: red;} div {color: green;}'])).toMatchInlineSnapshot(`
Array [
"body{background:red;}",
"div{color:green;}",
]
`);
});
});