File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
example/webpack/components Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 1313 </script >
1414
1515<style module >
16- div {
16+ :local( div ) {
1717 text-align : right ;
1818 font-size : 1.2rem ;
1919 font-family : monospace ;
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 }
Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments