Skip to content

Commit d652577

Browse files
author
Michael Vurchio
committed
Add more test
1 parent 83f73b6 commit d652577

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

example/webpack/components/Time.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</script>
1414

1515
<style module>
16-
div {
16+
:local(div) {
1717
text-align: right;
1818
font-size: 1.2rem;
1919
font-family: monospace;
@@ -26,9 +26,7 @@
2626
:local(.bolder:last-child) + p:not(:first-child) {
2727
color: blue;
2828
}
29-
@media (min-width: 20rem) {
3029
31-
}
3230
:global(.bolder:last-child + p:not(:first-child)) p.bold {
3331
font-weight: bolder;
3432
}

test/nativeFixtures/stylesAttribute.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,35 @@ describe('Native Mode', () => {
5757
expect(output).toBe(expectedOutput);
5858
});
5959

60+
test('Scoped local selector', async () => {
61+
const source =
62+
'<style module>'+
63+
':local(div) { text-align: right }'+
64+
'.bold.red:last-child :global(div) span.light span.light:first-child { color: red; }'+
65+
':global(div) :local(p > strong) { font-weight: 600; }'+
66+
':local(.bolder:last-child + p:not(:first-child)) p.bold { color: blue; }'+
67+
'.boldest:last-child + :local(p:not(:first-child)) { color: blue; }'+
68+
'</style>'+
69+
'<span class="red bold center">Red</span>';
70+
71+
const expectedOutput =
72+
'<style module>'+
73+
'div { text-align: right }'+
74+
':global(.bold-123.red-123:last-child) :global(div) :global(span.light-123 span.light-123:first-child) { color: red; }'+
75+
':global(div) p > strong { font-weight: 600; }'+
76+
'.bolder:last-child + p:not(:first-child) :global(p.bold-123) { color: blue; }'+
77+
':global(.boldest-123:last-child +) p:not(:first-child) { color: blue; }'+
78+
'</style>'+
79+
'<span class="red-123 bold-123 center">Red</span>';
80+
81+
const output = await compiler({
82+
source,
83+
},{
84+
mode: 'native',
85+
localIdentName: '[local]-123',
86+
});
87+
88+
expect(output).toBe(expectedOutput);
89+
});
90+
6091
});

0 commit comments

Comments
 (0)