-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathinheritance.test.ts
More file actions
121 lines (115 loc) · 1.97 KB
/
inheritance.test.ts
File metadata and controls
121 lines (115 loc) · 1.97 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { compile } from "../compiler";
test("nested classes", () => {
const compiled = compile(`
.my-class .test {
color: red;
}`);
expect(compiled.stylesheet()).toStrictEqual({
s: [
[
"my-class",
[
{
c: ["my-class"],
s: [0],
},
],
],
[
"test",
[
{
cq: [{ n: "my-class" }],
d: [{ color: "#f00" }],
v: [["__rn-css-color", "#f00"]],
s: [1, 2],
},
],
],
],
});
});
test("multiple tiers classes", () => {
const compiled = compile(`
.one .two .test {
color: red;
}`);
expect(compiled.stylesheet()).toStrictEqual({
s: [
[
"one",
[
{
c: ["one"],
s: [0],
},
],
],
[
"two",
[
{
c: ["two"],
s: [0],
},
],
],
[
"test",
[
{
cq: [{ n: "one" }, { n: "two" }],
d: [{ color: "#f00" }],
v: [["__rn-css-color", "#f00"]],
s: [1, 3],
},
],
],
],
});
});
test("tiers with multiple classes", () => {
const compiled = compile(`
.one .two.three .test {
color: red;
}`);
expect(compiled.stylesheet()).toStrictEqual({
s: [
[
"one",
[
{
c: ["one"],
s: [0],
},
],
],
[
"three",
[
{
c: ["three.two"],
s: [0],
aq: [["a", "className", "*=", "two"]],
},
],
],
[
"test",
[
{
cq: [
{ n: "one" },
{
n: "three.two",
},
],
d: [{ color: "#f00" }],
v: [["__rn-css-color", "#f00"]],
s: [1, 4],
},
],
],
],
});
});