ripple 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +2 -5
- package/tests/client/basic/basic.attributes.test.tsrx +4 -10
- package/tests/client/composite/composite.render.test.tsrx +4 -6
- package/tests/client/css/global-additional-cases.test.tsrx +27 -27
- package/tests/client/css/global-advanced-selectors.test.tsrx +2 -2
- package/tests/client/css/global-at-rules.test.tsrx +5 -5
- package/tests/client/css/global-basic.test.tsrx +8 -8
- package/tests/client/css/global-classes-ids.test.tsrx +13 -13
- package/tests/client/css/global-combinators.test.tsrx +8 -8
- package/tests/client/css/global-complex-nesting.test.tsrx +19 -19
- package/tests/client/css/global-edge-cases.test.tsrx +12 -12
- package/tests/client/css/global-keyframes.test.tsrx +7 -7
- package/tests/client/css/global-nested.test.tsrx +10 -10
- package/tests/client/css/global-pseudo.test.tsrx +7 -7
- package/tests/client/css/global-scoping.test.tsrx +20 -20
- package/tests/client/css/style-identifier.test.tsrx +7 -7
- package/tests/client/dynamic-elements.test.tsrx +14 -14
- package/tests/server/basic.attributes.test.tsrx +4 -10
- package/tests/server/dynamic-elements.test.tsrx +11 -11
- package/tests/server/style-identifier.test.tsrx +12 -14
- package/src/compiler/types/rpc.d.ts +0 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ripple is an elegant TypeScript UI framework",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.21",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/runtime/index-client.js",
|
|
9
9
|
"main": "src/runtime/index-client.js",
|
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
"./compiler/internal/import": {
|
|
37
37
|
"types": "./src/compiler/types/import.d.ts"
|
|
38
38
|
},
|
|
39
|
-
"./compiler/internal/rpc": {
|
|
40
|
-
"types": "./src/compiler/types/rpc.d.ts"
|
|
41
|
-
},
|
|
42
39
|
"./validator": {
|
|
43
40
|
"types": "./types/index.d.ts",
|
|
44
41
|
"require": "./validator/index.js",
|
|
@@ -86,6 +83,6 @@
|
|
|
86
83
|
"@tsrx/ripple": "0.0.5"
|
|
87
84
|
},
|
|
88
85
|
"peerDependencies": {
|
|
89
|
-
"ripple": "0.3.
|
|
86
|
+
"ripple": "0.3.21"
|
|
90
87
|
}
|
|
91
88
|
}
|
|
@@ -37,9 +37,7 @@ describe('basic client > attribute rendering', () => {
|
|
|
37
37
|
const button = container.querySelector('button');
|
|
38
38
|
const div = container.querySelector('div');
|
|
39
39
|
|
|
40
|
-
expect(Array.from(div.classList).some((className) => className.startsWith('
|
|
41
|
-
true,
|
|
42
|
-
);
|
|
40
|
+
expect(Array.from(div.classList).some((className) => className.startsWith('tsrx-'))).toBe(true);
|
|
43
41
|
expect(div.classList.contains('inactive')).toBe(true);
|
|
44
42
|
|
|
45
43
|
button.click();
|
|
@@ -82,9 +80,7 @@ describe('basic client > attribute rendering', () => {
|
|
|
82
80
|
|
|
83
81
|
const div = container.querySelector('div');
|
|
84
82
|
|
|
85
|
-
expect(Array.from(div.classList).some((className) => className.startsWith('
|
|
86
|
-
true,
|
|
87
|
-
);
|
|
83
|
+
expect(Array.from(div.classList).some((className) => className.startsWith('tsrx-'))).toBe(true);
|
|
88
84
|
expect(div.classList.contains('foo')).toBe(true);
|
|
89
85
|
expect(div.classList.contains('bar')).toBe(true);
|
|
90
86
|
expect(div.classList.contains('baz')).toBe(true);
|
|
@@ -121,9 +117,7 @@ describe('basic client > attribute rendering', () => {
|
|
|
121
117
|
const button = container.querySelector('button');
|
|
122
118
|
const div = container.querySelector('div');
|
|
123
119
|
|
|
124
|
-
expect(Array.from(div.classList).some((className) => className.startsWith('
|
|
125
|
-
true,
|
|
126
|
-
);
|
|
120
|
+
expect(Array.from(div.classList).some((className) => className.startsWith('tsrx-'))).toBe(true);
|
|
127
121
|
expect(div.classList.contains('inactive')).toBe(true);
|
|
128
122
|
expect(div.classList.contains('active')).toBe(false);
|
|
129
123
|
|
|
@@ -162,7 +156,7 @@ describe('basic client > attribute rendering', () => {
|
|
|
162
156
|
const divs = container.querySelectorAll('div');
|
|
163
157
|
|
|
164
158
|
divs.forEach((div) => {
|
|
165
|
-
expect(Array.from(div.classList).some((className) => className.startsWith('
|
|
159
|
+
expect(Array.from(div.classList).some((className) => className.startsWith('tsrx-'))).toBe(
|
|
166
160
|
true,
|
|
167
161
|
);
|
|
168
162
|
});
|
|
@@ -137,10 +137,8 @@ describe('composite > render', () => {
|
|
|
137
137
|
|
|
138
138
|
const wrapper = container.querySelector('.green');
|
|
139
139
|
const child = container.querySelector('.red');
|
|
140
|
-
const wrapper_scopes = Array.from(wrapper.classList).filter(
|
|
141
|
-
|
|
142
|
-
);
|
|
143
|
-
const child_scopes = Array.from(child.classList).filter((name) => name.startsWith('ripple-'));
|
|
140
|
+
const wrapper_scopes = Array.from(wrapper.classList).filter((name) => name.startsWith('tsrx-'));
|
|
141
|
+
const child_scopes = Array.from(child.classList).filter((name) => name.startsWith('tsrx-'));
|
|
144
142
|
|
|
145
143
|
expect(wrapper_scopes).toHaveLength(1);
|
|
146
144
|
expect(child_scopes).toHaveLength(1);
|
|
@@ -230,8 +228,8 @@ describe('scoped styles with children', () => {
|
|
|
230
228
|
const wrapper = container.querySelector('.green');
|
|
231
229
|
const child = container.querySelector('.red');
|
|
232
230
|
|
|
233
|
-
const wrapper_classes = Array.from(wrapper.classList).filter((c) => c.startsWith('
|
|
234
|
-
const child_classes = Array.from(child.classList).filter((c) => c.startsWith('
|
|
231
|
+
const wrapper_classes = Array.from(wrapper.classList).filter((c) => c.startsWith('tsrx-'));
|
|
232
|
+
const child_classes = Array.from(child.classList).filter((c) => c.startsWith('tsrx-'));
|
|
235
233
|
|
|
236
234
|
expect(wrapper_classes).toHaveLength(1);
|
|
237
235
|
expect(child_classes).toHaveLength(1);
|
|
@@ -15,7 +15,7 @@ export component Test() {
|
|
|
15
15
|
}`;
|
|
16
16
|
const { css } = compile(source, 'test.tsrx');
|
|
17
17
|
|
|
18
|
-
expect(css).toMatch(/div\.
|
|
18
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+\.x {/);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('handles :global modifier in nested syntax', () => {
|
|
@@ -67,7 +67,7 @@ export component Test() {
|
|
|
67
67
|
}`;
|
|
68
68
|
const { css } = compile(source, 'test.tsrx');
|
|
69
69
|
|
|
70
|
-
expect(css).toMatch(/div\.
|
|
70
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+:is\(html\.dark-mode \*\) {/);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it('handles :global with & inside :global block', () => {
|
|
@@ -85,7 +85,7 @@ export component Test() {
|
|
|
85
85
|
}`;
|
|
86
86
|
const { css } = compile(source, 'test.tsrx');
|
|
87
87
|
|
|
88
|
-
expect(css).toMatch(/div\.
|
|
88
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
89
89
|
expect(css).toContain('&.class {');
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -105,7 +105,7 @@ export component Test() {
|
|
|
105
105
|
const { css } = compile(source, 'test.tsrx');
|
|
106
106
|
|
|
107
107
|
expect(css).toContain('* {');
|
|
108
|
-
expect(css).toMatch(/&:hover \.class\.
|
|
108
|
+
expect(css).toMatch(/&:hover \.class\.tsrx-[a-z0-9]+ {/);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
it('handles multiple :global selectors in list', () => {
|
|
@@ -142,7 +142,7 @@ export component Test() {
|
|
|
142
142
|
}`;
|
|
143
143
|
const { css } = compile(source, 'test.tsrx');
|
|
144
144
|
|
|
145
|
-
expect(css).toMatch(/div\.
|
|
145
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+/);
|
|
146
146
|
expect(css).toContain('z {');
|
|
147
147
|
});
|
|
148
148
|
|
|
@@ -180,8 +180,8 @@ export component Test() {
|
|
|
180
180
|
expect(css).toContain('@keyframes test-in {');
|
|
181
181
|
expect(css).toContain('.x {');
|
|
182
182
|
expect(css).toContain('.y {');
|
|
183
|
-
expect(css).toMatch(/@keyframes
|
|
184
|
-
expect(css).not.toMatch(/\.x\.
|
|
183
|
+
expect(css).toMatch(/@keyframes tsrx-[a-z0-9]+-test/);
|
|
184
|
+
expect(css).not.toMatch(/\.x\.tsrx-[a-z0-9]+/);
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
it('handles global keyframes with no component elements', () => {
|
|
@@ -222,9 +222,9 @@ export component Test() {
|
|
|
222
222
|
}`;
|
|
223
223
|
const { css } = compile(source, 'test.tsrx');
|
|
224
224
|
|
|
225
|
-
expect(css).toMatch(/div\.
|
|
226
|
-
expect(css).toMatch(/span\.blue\.x\.
|
|
227
|
-
expect(css).toMatch(/span\.x\.
|
|
225
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+\.blue {/);
|
|
226
|
+
expect(css).toMatch(/span\.blue\.x\.tsrx-[a-z0-9]+ {/);
|
|
227
|
+
expect(css).toMatch(/span\.x\.tsrx-[a-z0-9]+\.bg {/);
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
it('handles multiple :global() in descendant sequence', () => {
|
|
@@ -241,7 +241,7 @@ export component Test() {
|
|
|
241
241
|
const { css } = compile(source, 'test.tsrx');
|
|
242
242
|
|
|
243
243
|
expect(css).toContain('div > section > p');
|
|
244
|
-
expect(css).toMatch(/p\.
|
|
244
|
+
expect(css).toMatch(/p\.tsrx-[a-z0-9]+ {/);
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
it('handles :is with :global and html context', () => {
|
|
@@ -261,7 +261,7 @@ export component Test() {
|
|
|
261
261
|
}`;
|
|
262
262
|
const { css } = compile(source, 'test.tsrx');
|
|
263
263
|
|
|
264
|
-
expect(css).toMatch(/x\.
|
|
264
|
+
expect(css).toMatch(/x\.tsrx-[a-z0-9]+ :is\(html \*\) {/);
|
|
265
265
|
});
|
|
266
266
|
|
|
267
267
|
it('handles :global block with :has inside', () => {
|
|
@@ -289,9 +289,9 @@ export component Test() {
|
|
|
289
289
|
const { css } = compile(source, 'test.tsrx');
|
|
290
290
|
|
|
291
291
|
expect(css).toContain('.foo {');
|
|
292
|
-
expect(css).toMatch(/\.
|
|
293
|
-
expect(css).toMatch(/&:has\(x\.
|
|
294
|
-
expect(css).toMatch(/.foo:has\(x\.
|
|
292
|
+
expect(css).toMatch(/\.tsrx-[a-z0-9]+:has\(x:where\(\.tsrx-[a-z0-9]+\)\) {/);
|
|
293
|
+
expect(css).toMatch(/&:has\(x\.tsrx-[a-z0-9]+\) {/);
|
|
294
|
+
expect(css).toMatch(/.foo:has\(x\.tsrx-[a-z0-9]+\) {/);
|
|
295
295
|
});
|
|
296
296
|
|
|
297
297
|
it('handles :not with :global in complex nesting', () => {
|
|
@@ -378,7 +378,7 @@ export component Test({ children }) {
|
|
|
378
378
|
}`;
|
|
379
379
|
const { css } = compile(source, 'test.tsrx');
|
|
380
380
|
|
|
381
|
-
expect(css).toMatch(/\.before\.
|
|
381
|
+
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
382
382
|
expect((css.match(/\.x\ /g) || []).length).toBe(0);
|
|
383
383
|
expect((css.match(/\(unused\) :global\(\.x\) /g) || []).length).toBe(6);
|
|
384
384
|
expect(css).toContain('(unused) :global(.x) + .bar {');
|
|
@@ -419,7 +419,7 @@ component Child1() {
|
|
|
419
419
|
}`;
|
|
420
420
|
const { css } = compile(source, 'test.tsrx');
|
|
421
421
|
|
|
422
|
-
expect(css).toMatch(/\.before\.
|
|
422
|
+
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
423
423
|
expect((css.match(/\.x\ /g) || []).length).toBe(5);
|
|
424
424
|
expect((css.match(/\(unused\) :global\(\.x\) /g) || []).length).toBe(1);
|
|
425
425
|
expect(css).toContain('(unused) :global(.x) + .bar {');
|
|
@@ -465,7 +465,7 @@ component Child1() {
|
|
|
465
465
|
}`;
|
|
466
466
|
const { css } = compile(source, 'test.tsrx');
|
|
467
467
|
|
|
468
|
-
expect(css).toMatch(/\.before\.
|
|
468
|
+
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
469
469
|
expect((css.match(/\.x\ /g) || []).length).toBe(5);
|
|
470
470
|
expect((css.match(/\(unused\) :global\(\.x\) /g) || []).length).toBe(1);
|
|
471
471
|
expect(css).toContain('(unused) :global(.x) + .bar {');
|
|
@@ -509,7 +509,7 @@ export component Test({ children, classes }) {
|
|
|
509
509
|
|
|
510
510
|
const { css } = compile(source, 'test.tsrx');
|
|
511
511
|
|
|
512
|
-
expect(css).toMatch(/\.before\.
|
|
512
|
+
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
513
513
|
expect((css.match(/\.x\ /g) || []).length).toBe(5);
|
|
514
514
|
expect((css.match(/\(unused\) :global\(\.x\) /g) || []).length).toBe(1);
|
|
515
515
|
expect(css).toContain('(unused) :global(.x) + .bar {');
|
|
@@ -533,7 +533,7 @@ export component Test() {
|
|
|
533
533
|
}`;
|
|
534
534
|
const { css } = compile(source, 'test.tsrx');
|
|
535
535
|
|
|
536
|
-
expect(css).toMatch(/html body \.root\.
|
|
536
|
+
expect(css).toMatch(/html body \.root\.tsrx-[a-z0-9]+ p:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
537
537
|
});
|
|
538
538
|
|
|
539
539
|
it('handles nested @media with :global blocks', () => {
|
|
@@ -561,7 +561,7 @@ export component Test() {
|
|
|
561
561
|
|
|
562
562
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
563
563
|
expect(css).toContain('.foo {');
|
|
564
|
-
expect(css).not.toMatch(/\.foo\.
|
|
564
|
+
expect(css).not.toMatch(/\.foo\.tsrx-[a-z0-9]+/);
|
|
565
565
|
});
|
|
566
566
|
|
|
567
567
|
it('handles :has with complex combinators', () => {
|
|
@@ -591,7 +591,7 @@ export component Test() {
|
|
|
591
591
|
const { css } = compile(source, 'test.tsrx');
|
|
592
592
|
|
|
593
593
|
expect(css).toMatch(
|
|
594
|
-
/g\.
|
|
594
|
+
/g\.tsrx-[a-z0-9]+:has\(> h:where\(\.tsrx-[a-z0-9]+\) > i:where\(\.tsrx-[a-z0-9]+\)\)/,
|
|
595
595
|
);
|
|
596
596
|
expect(css).toContain('(unused) h:has(> h > i)');
|
|
597
597
|
});
|
|
@@ -614,7 +614,7 @@ export component Test() {
|
|
|
614
614
|
}`;
|
|
615
615
|
const { css } = compile(source, 'test.tsrx');
|
|
616
616
|
|
|
617
|
-
expect(css).toMatch(/div\.
|
|
617
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ h1\[data-title="Hello, world!"\]/);
|
|
618
618
|
expect(css).toContain('h1[attribute], video[autoplay]');
|
|
619
619
|
});
|
|
620
620
|
|
|
@@ -633,7 +633,7 @@ export component Test() {
|
|
|
633
633
|
}`;
|
|
634
634
|
const { css } = compile(source, 'test.tsrx');
|
|
635
635
|
|
|
636
|
-
expect(css).toMatch(/div\.
|
|
636
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ \.h1\\,h2\\,h3 {/);
|
|
637
637
|
});
|
|
638
638
|
|
|
639
639
|
/**
|
|
@@ -658,8 +658,8 @@ export component Test() {
|
|
|
658
658
|
}`;
|
|
659
659
|
const { css } = compile(source, 'test.tsrx');
|
|
660
660
|
|
|
661
|
-
expect(css).toMatch(/div\.
|
|
662
|
-
expect(css).toMatch(/div\.
|
|
661
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :is\(h1, h2\)/);
|
|
662
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :where\(h1, h2\)/);
|
|
663
663
|
});
|
|
664
664
|
|
|
665
665
|
it('handles :global with :is containing compound selectors', () => {
|
|
@@ -679,7 +679,7 @@ export component Test() {
|
|
|
679
679
|
}`;
|
|
680
680
|
const { css } = compile(source, 'test.tsrx');
|
|
681
681
|
|
|
682
|
-
expect(css).toMatch(/div\.
|
|
682
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ h1 ~ :is\(h2, h3\)/);
|
|
683
683
|
});
|
|
684
684
|
|
|
685
685
|
it('handles :global with pseudo-elements', () => {
|
|
@@ -20,7 +20,7 @@ export component Test() {
|
|
|
20
20
|
}`;
|
|
21
21
|
const { css } = compile(source, 'test.tsrx');
|
|
22
22
|
|
|
23
|
-
expect(css).toMatch(/div\.
|
|
23
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ ::slotted\(span\) {/);
|
|
24
24
|
expect(css).toContain('::slotted(*) {');
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -41,7 +41,7 @@ export component Test() {
|
|
|
41
41
|
}`;
|
|
42
42
|
const { css } = compile(source, 'test.tsrx');
|
|
43
43
|
|
|
44
|
-
expect(css).toMatch(/div\.
|
|
44
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ ::part\(input\) {/);
|
|
45
45
|
expect(css).toContain('::part(button) {');
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -22,7 +22,7 @@ export component Test() {
|
|
|
22
22
|
|
|
23
23
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
24
24
|
expect(css).toContain('div {');
|
|
25
|
-
expect(css).toMatch(/div\.
|
|
25
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ span {/);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it('handles :global inside @supports queries', () => {
|
|
@@ -46,7 +46,7 @@ export component Test() {
|
|
|
46
46
|
|
|
47
47
|
expect(css).toContain('@supports (display: grid) {');
|
|
48
48
|
expect(css).toContain('.container {');
|
|
49
|
-
expect(css).toMatch(/div\.
|
|
49
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ \.item {/);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it('handles nested @media with :global', () => {
|
|
@@ -74,8 +74,8 @@ export component Test() {
|
|
|
74
74
|
|
|
75
75
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
76
76
|
expect(css).toContain('.foo {');
|
|
77
|
-
expect(css).not.toMatch(/\.foo\.
|
|
78
|
-
expect(css).toMatch(/div\.
|
|
77
|
+
expect(css).not.toMatch(/\.foo\.tsrx-[a-z0-9]+/);
|
|
78
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
it('handles :global in @container queries', () => {
|
|
@@ -121,6 +121,6 @@ export component Test() {
|
|
|
121
121
|
expect(css).toContain('@media screen {');
|
|
122
122
|
expect(css).toContain('@supports (display: flex) {');
|
|
123
123
|
expect(css).toContain('.flex-container {');
|
|
124
|
-
expect(css).toMatch(/div\.
|
|
124
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ \.flex-item {/);
|
|
125
125
|
});
|
|
126
126
|
});
|
|
@@ -16,7 +16,7 @@ export component Test() {
|
|
|
16
16
|
|
|
17
17
|
expect(css).toContain('div {');
|
|
18
18
|
expect(css).toContain('color: red;');
|
|
19
|
-
expect(css).not.toMatch(/div\.
|
|
19
|
+
expect(css).not.toMatch(/div\.tsrx-[a-z0-9]+/);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it('applies global selector with class', () => {
|
|
@@ -38,7 +38,7 @@ export component Test() {
|
|
|
38
38
|
|
|
39
39
|
expect(css).toContain('div.foo {');
|
|
40
40
|
expect(css).toContain('.foo {');
|
|
41
|
-
expect(css).not.toMatch(/\.foo\.
|
|
41
|
+
expect(css).not.toMatch(/\.foo\.tsrx-[a-z0-9]+/);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it('mixes global and local selectors', () => {
|
|
@@ -62,7 +62,7 @@ export component Test() {
|
|
|
62
62
|
|
|
63
63
|
expect(css).toContain('div .foo');
|
|
64
64
|
expect(css).toContain('div > .foo');
|
|
65
|
-
expect(css).toMatch(/\.foo\.
|
|
65
|
+
expect(css).toMatch(/\.foo\.tsrx-[a-z0-9]+/);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it('handles global block syntax', () => {
|
|
@@ -86,7 +86,7 @@ export component Test() {
|
|
|
86
86
|
|
|
87
87
|
expect(css).toContain('.x {');
|
|
88
88
|
expect(css).toContain('.a, .selector, .list {');
|
|
89
|
-
expect(css).not.toMatch(/\.x\.
|
|
89
|
+
expect(css).not.toMatch(/\.x\.tsrx-[a-z0-9]+/);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
it('handles global with pseudo-classes', () => {
|
|
@@ -108,7 +108,7 @@ export component Test() {
|
|
|
108
108
|
|
|
109
109
|
expect(css).toContain('button:hover {');
|
|
110
110
|
expect(css).toContain('button:focus {');
|
|
111
|
-
expect(css).not.toMatch(/button\.
|
|
111
|
+
expect(css).not.toMatch(/button\.tsrx-[a-z0-9]+/);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it('handles multiple global selectors in selector list', () => {
|
|
@@ -157,9 +157,9 @@ export component Test() {
|
|
|
157
157
|
}`;
|
|
158
158
|
const { css } = compile(source, 'test.tsrx');
|
|
159
159
|
|
|
160
|
-
expect(css).toMatch(/\.styled-container\.
|
|
161
|
-
expect(css).toMatch(/\.text\.
|
|
160
|
+
expect(css).toMatch(/\.styled-container\.tsrx-[a-z0-9]+/);
|
|
161
|
+
expect(css).toMatch(/\.text\.tsrx-[a-z0-9]+/);
|
|
162
162
|
expect(css).toContain('h1 {');
|
|
163
|
-
expect(css).not.toMatch(/h1\.
|
|
163
|
+
expect(css).not.toMatch(/h1\.tsrx-[a-z0-9]+/);
|
|
164
164
|
});
|
|
165
165
|
});
|
|
@@ -15,7 +15,7 @@ export component Test() {
|
|
|
15
15
|
const { css } = compile(source, 'test.tsrx');
|
|
16
16
|
|
|
17
17
|
expect(css).toContain('.foo {');
|
|
18
|
-
expect(css).not.toMatch(/\.foo\.
|
|
18
|
+
expect(css).not.toMatch(/\.foo\.tsrx-[a-z0-9]+/);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('handles :global with chained classes', () => {
|
|
@@ -40,8 +40,8 @@ export component Test() {
|
|
|
40
40
|
const { css } = compile(source, 'test.tsrx');
|
|
41
41
|
|
|
42
42
|
expect(css).toContain('.foo.bar {');
|
|
43
|
-
expect(css).toMatch(/\.foo\.bar\.
|
|
44
|
-
expect(css).toMatch(/\.foo\.
|
|
43
|
+
expect(css).toMatch(/\.foo\.bar\.tsrx-[a-z0-9]+ {/);
|
|
44
|
+
expect(css).toMatch(/\.foo\.tsrx-[a-z0-9]+\.bar {/);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
it('handles local class inside :global selector', () => {
|
|
@@ -63,7 +63,7 @@ export component Test() {
|
|
|
63
63
|
}`;
|
|
64
64
|
const { css } = compile(source, 'test.tsrx');
|
|
65
65
|
|
|
66
|
-
expect(css).toMatch(/\.outer \.inner\.
|
|
66
|
+
expect(css).toMatch(/\.outer \.inner\.tsrx-[a-z0-9]+ {/);
|
|
67
67
|
expect(css).toMatch(/\(unused\) :global\(div\) \.foo {/);
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -92,8 +92,8 @@ export component Test() {
|
|
|
92
92
|
|
|
93
93
|
expect(css).toContain('#app {');
|
|
94
94
|
expect(css).not.toContain('#app #content {');
|
|
95
|
-
expect(css).not.toMatch(/#app\.
|
|
96
|
-
expect(css).toMatch(/div\.
|
|
95
|
+
expect(css).not.toMatch(/#app\.tsrx-[a-z0-9]+/);
|
|
96
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ #content {/);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('handles :global with class and ID combination', () => {
|
|
@@ -118,8 +118,8 @@ export component Test() {
|
|
|
118
118
|
const { css } = compile(source, 'test.tsrx');
|
|
119
119
|
|
|
120
120
|
expect(css).toContain('#app.container {');
|
|
121
|
-
expect(css).toMatch(/\.container#app\.
|
|
122
|
-
expect(css).toMatch(/#app\.
|
|
121
|
+
expect(css).toMatch(/\.container#app\.tsrx-[a-z0-9]+ {/);
|
|
122
|
+
expect(css).toMatch(/#app\.tsrx-[a-z0-9]+\.container {/);
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
it('handles multiple classes with :global', () => {
|
|
@@ -143,8 +143,8 @@ export component Test() {
|
|
|
143
143
|
}`;
|
|
144
144
|
const { css } = compile(source, 'test.tsrx');
|
|
145
145
|
|
|
146
|
-
expect((css.match(/\.a\.b\.c\.
|
|
147
|
-
expect(css).toMatch(/\.a\.b\.
|
|
146
|
+
expect((css.match(/\.a\.b\.c\.tsrx-[a-z0-9]+ {/g) || []).length).toBe(2);
|
|
147
|
+
expect(css).toMatch(/\.a\.b\.tsrx-[a-z0-9]+\.c {/);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it('handles :global with class descendant selectors', () => {
|
|
@@ -172,8 +172,8 @@ export component Test() {
|
|
|
172
172
|
}`;
|
|
173
173
|
const { css } = compile(source, 'test.tsrx');
|
|
174
174
|
|
|
175
|
-
expect(css).toMatch(/\.outer \.middle\.
|
|
176
|
-
expect(css).toMatch(/\.outer\.
|
|
177
|
-
expect(css).toMatch(/\.outer\.
|
|
175
|
+
expect(css).toMatch(/\.outer \.middle\.tsrx-[a-z0-9]+ \.inner:where\(\.tsrx-[a-z0-9]+\)/);
|
|
176
|
+
expect(css).toMatch(/\.outer\.tsrx-[a-z0-9]+ \.middle \.inner {/);
|
|
177
|
+
expect(css).toMatch(/\.outer\.tsrx-[a-z0-9]+ \.middle:where\(\.tsrx-[a-z0-9]+\)\.inner/);
|
|
178
178
|
});
|
|
179
179
|
});
|
|
@@ -16,8 +16,8 @@ export component Test() {
|
|
|
16
16
|
}`;
|
|
17
17
|
const { css } = compile(source, 'test.tsrx');
|
|
18
18
|
|
|
19
|
-
expect(css).toMatch(/div\.
|
|
20
|
-
expect(css).not.toMatch(/span\.
|
|
19
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ > span {/);
|
|
20
|
+
expect(css).not.toMatch(/span\.tsrx-[a-z0-9]+/);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
it('handles :global with adjacent sibling combinator', () => {
|
|
@@ -40,7 +40,7 @@ export component Test() {
|
|
|
40
40
|
}`;
|
|
41
41
|
const { css } = compile(source, 'test.tsrx');
|
|
42
42
|
|
|
43
|
-
expect(css).toMatch(/span\.
|
|
43
|
+
expect(css).toMatch(/span\.tsrx-[a-z0-9]+ \+ span {/);
|
|
44
44
|
expect(css).toContain('(unused) :global(div) + span {');
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -66,7 +66,7 @@ export component Test() {
|
|
|
66
66
|
|
|
67
67
|
expect(css).toContain('~');
|
|
68
68
|
|
|
69
|
-
expect(css).toMatch(/span\.
|
|
69
|
+
expect(css).toMatch(/span\.tsrx-[a-z0-9]+ ~ span {/);
|
|
70
70
|
expect(css).toMatch('(unused) :global(div) ~ span {');
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -92,8 +92,8 @@ export component Test() {
|
|
|
92
92
|
}`;
|
|
93
93
|
const { css } = compile(source, 'test.tsrx');
|
|
94
94
|
|
|
95
|
-
expect(css).toMatch(/div\.
|
|
96
|
-
expect(css).toMatch(/div > span\.
|
|
95
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ > span > button {/);
|
|
96
|
+
expect(css).toMatch(/div > span\.tsrx-[a-z0-9]+ \+ button:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('handles :global with descendant combinator', () => {
|
|
@@ -118,7 +118,7 @@ export component Test() {
|
|
|
118
118
|
|
|
119
119
|
const { css } = compile(source, 'test.tsrx');
|
|
120
120
|
|
|
121
|
-
expect(css).toMatch(/div\.
|
|
122
|
-
expect(css).toMatch(/div span\.
|
|
121
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ span button {/);
|
|
122
|
+
expect(css).toMatch(/div span\.tsrx-[a-z0-9]+ button:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
123
123
|
});
|
|
124
124
|
});
|
|
@@ -26,9 +26,9 @@ export component Test() {
|
|
|
26
26
|
}`;
|
|
27
27
|
const { css } = compile(source, 'test.tsrx');
|
|
28
28
|
|
|
29
|
-
expect(css).not.toMatch(/div\.
|
|
30
|
-
expect(css).not.toMatch(/span\.
|
|
31
|
-
expect(css).not.toMatch(/button\.
|
|
29
|
+
expect(css).not.toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
30
|
+
expect(css).not.toMatch(/span\.tsrx-[a-z0-9]+ {/);
|
|
31
|
+
expect(css).not.toMatch(/button\.tsrx-[a-z0-9]+ {/);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('handles local block with :global nested inside', () => {
|
|
@@ -54,8 +54,8 @@ export component Test() {
|
|
|
54
54
|
}`;
|
|
55
55
|
const { css } = compile(source, 'test.tsrx');
|
|
56
56
|
|
|
57
|
-
expect(css).toMatch(/div\.
|
|
58
|
-
expect(css).not.toMatch(/span\.
|
|
57
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
58
|
+
expect(css).not.toMatch(/span\.tsrx-[a-z0-9]+ {/);
|
|
59
59
|
expect(css).toContain('(unused) p {');
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -82,8 +82,8 @@ export component Test() {
|
|
|
82
82
|
|
|
83
83
|
expect(css).toContain('div {');
|
|
84
84
|
expect(css).toContain('.local {');
|
|
85
|
-
expect(css).not.toMatch(/div\.
|
|
86
|
-
expect(css).not.toMatch(/\.local\.
|
|
85
|
+
expect(css).not.toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
86
|
+
expect(css).not.toMatch(/\.local\.tsrx-[a-z0-9]+ {/);
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it('handles alternating :global and local nesting', () => {
|
|
@@ -111,8 +111,8 @@ export component Test() {
|
|
|
111
111
|
}`;
|
|
112
112
|
const { css } = compile(source, 'test.tsrx');
|
|
113
113
|
|
|
114
|
-
expect(css).toMatch(/div\.
|
|
115
|
-
expect(css).toMatch(/button\.
|
|
114
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
115
|
+
expect(css).toMatch(/button\.tsrx-[a-z0-9]+ {/);
|
|
116
116
|
expect(css).toContain('span {');
|
|
117
117
|
expect(css).toContain('em {');
|
|
118
118
|
});
|
|
@@ -142,11 +142,11 @@ export component Test() {
|
|
|
142
142
|
}`;
|
|
143
143
|
const { css } = compile(source, 'test.tsrx');
|
|
144
144
|
|
|
145
|
-
expect(css).toMatch(/div\.
|
|
145
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
146
146
|
expect(css).toContain('span {');
|
|
147
147
|
expect(css).toContain('button {');
|
|
148
|
-
expect(css).not.toMatch(/span\.
|
|
149
|
-
expect(css).not.toMatch(/button\.
|
|
148
|
+
expect(css).not.toMatch(/span\.tsrx-[a-z0-9]+/);
|
|
149
|
+
expect(css).not.toMatch(/button\.tsrx-[a-z0-9]+/);
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
it('handles :global with nesting combinator &', () => {
|
|
@@ -174,8 +174,8 @@ export component Test() {
|
|
|
174
174
|
}`;
|
|
175
175
|
const { css } = compile(source, 'test.tsrx');
|
|
176
176
|
|
|
177
|
-
expect(css).toMatch(/\.container\.
|
|
178
|
-
expect(css).toMatch(/button\.
|
|
177
|
+
expect(css).toMatch(/\.container\.tsrx-[a-z0-9]+ {/);
|
|
178
|
+
expect(css).toMatch(/button\.tsrx-[a-z0-9]+ {/);
|
|
179
179
|
expect(css).toContain('&.active {');
|
|
180
180
|
expect(css).toContain('&.pressed {');
|
|
181
181
|
});
|
|
@@ -209,13 +209,13 @@ export component Test() {
|
|
|
209
209
|
}`;
|
|
210
210
|
const { css } = compile(source, 'test.tsrx');
|
|
211
211
|
|
|
212
|
-
expect(css).toMatch(/div\.
|
|
213
|
-
expect(css).toMatch(/ul\.
|
|
214
|
-
expect(css).toMatch(/a\.
|
|
212
|
+
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
213
|
+
expect(css).toMatch(/ul\.tsrx-[a-z0-9]+ {/);
|
|
214
|
+
expect(css).toMatch(/a\.tsrx-[a-z0-9]+ {/);
|
|
215
215
|
|
|
216
216
|
expect(css).toContain('nav {');
|
|
217
217
|
expect(css).toContain('li {');
|
|
218
|
-
expect(css).not.toMatch(/nav\.
|
|
219
|
-
expect(css).not.toMatch(/li\.
|
|
218
|
+
expect(css).not.toMatch(/nav\.tsrx-[a-z0-9]+ {/);
|
|
219
|
+
expect(css).not.toMatch(/li\.tsrx-[a-z0-9]+ {/);
|
|
220
220
|
});
|
|
221
221
|
});
|