File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -257,13 +257,26 @@ describe('Errors', () => {
257257
258258 it ( 'should not return an error for a placeholder as the declaration name (#52)' , ( ) => {
259259 return getSemanticDiagnosticsForFile (
260- `function css(strings, ...) { return ""; }; const value = 1; const q = css\`
260+ `function css(strings, ...) { return ""; }; const q = css\`
261261 $\{'width'}: 1px;
262262 \``
263263 ) . then ( errorResponse => {
264264 assert . isTrue ( errorResponse . success ) ;
265265 assert . strictEqual ( errorResponse . body . length , 0 ) ;
266266 } ) ;
267267 } ) ;
268+
269+ it ( 'should not return an error for a placeholder as part of a rule (#59)' , ( ) => {
270+ return getSemanticDiagnosticsForFile (
271+ `function css(strings, ...) { return ""; }; const q = css\`
272+ $\{'a'}, \${'button'} {
273+ width: 1px;
274+ }
275+ \``
276+ ) . then ( errorResponse => {
277+ assert . isTrue ( errorResponse . success ) ;
278+ assert . strictEqual ( errorResponse . body . length , 0 ) ;
279+ } ) ;
280+ } ) ;
268281} ) ;
269282
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ function getReplacementCharacter(
7373 post : string
7474) {
7575 if ( pre . match ( / ( ^ | \n ) \s * $ / g) ) {
76- if ( ! post . match ( / ^ \s * [ \{ \: ] / ) ) { // ${'button'} {
76+ if ( ! post . match ( / ^ \s * [ { : , ] / ) ) { // ${'button'} {
7777 return ' ' ;
7878 }
7979 }
Original file line number Diff line number Diff line change @@ -87,6 +87,21 @@ describe('substituter', () => {
8787 ] . join ( '\n' )
8888 ) ;
8989 } ) ;
90+
91+ it ( 'should insert x for placeholder used as part of a rule (#59)' , ( ) => {
92+ assert . deepEqual (
93+ performSubstitutions ( [
94+ '${"button"}, ${"a"} {' ,
95+ 'color: ${"red"};' ,
96+ '}' ,
97+ ] . join ( '\n' ) ) ,
98+ [
99+ 'xxxxxxxxxxx, xxxxxx {' ,
100+ 'color: xxxxxxxx;' ,
101+ '}' ,
102+ ] . join ( '\n' )
103+ ) ;
104+ } ) ;
90105} ) ;
91106
92107function performSubstitutions ( value : string ) {
You can’t perform that action at this time.
0 commit comments