File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const improperKeywordsRE =
23
23
24
24
const wsRE = / \s / g
25
25
const newlineRE = / \n / g
26
- const saveRE = / [ \{ , ] \s * [ \w \$ _ ] + \s * : | ( ' (?: [ ^ ' \\ ] | \\ .) * ' | " (?: [ ^ " \\ ] | \\ .) * " ) | n e w | t y p e o f | v o i d / g
26
+ const saveRE = / [ \{ , ] \s * [ \w \$ _ ] + \s * : | ( ' (?: [ ^ ' \\ ] | \\ .) * ' | " (?: [ ^ " \\ ] | \\ .) * " | ` (?: [ ^ ` \\ ] | \\ . ) * \$ \{ | \} (?: [ ^ ` \\ ] | \\ . ) * ` | ` (?: [ ^ ` \\ ] | \\ . ) * ` ) | n e w | t y p e o f | v o i d / g
27
27
const restoreRE = / " ( \d + ) " / g
28
28
const pathTestRE = / ^ [ A - Z a - z _ $ ] [ \w $ ] * (?: \. [ A - Z a - z _ $ ] [ \w $ ] * | \[ ' .* ?' \] | \[ " .* ?" \] | \[ \d + \] | \[ [ A - Z a - z _ $ ] [ \w $ ] * \] ) * $ /
29
29
const identRE = / [ ^ \w $ \. ] (?: [ A - Z a - z _ $ ] [ \w $ ] * ) / g
Original file line number Diff line number Diff line change @@ -286,6 +286,15 @@ describe('Expression Parser', function () {
286
286
expect ( res1 ) . toBe ( res2 )
287
287
} )
288
288
289
+ it ( 'ES2015 template string handling' , function ( ) {
290
+ var res = expParser . parseExpression ( 'a + `hi ${ b }` + c' )
291
+ expect ( res . get . toString ( ) . indexOf ( 'scope.a+`hi ${scope.b}`+scope.c' ) > - 1 ) . toBe ( true )
292
+ res = expParser . parseExpression ( '`hi ${ b + `${ d }` }`' )
293
+ expect ( res . get . toString ( ) . indexOf ( '`hi ${scope.b+`${scope.d}`}`' ) > - 1 ) . toBe ( true )
294
+ res = expParser . parseExpression ( '{transform:`rotate(${x}deg)`}' )
295
+ expect ( res . get . toString ( ) . indexOf ( '{transform:`rotate(${scope.x}deg)`}' ) > - 1 ) . toBe ( true )
296
+ } )
297
+
289
298
describe ( 'invalid expression' , function ( ) {
290
299
beforeEach ( function ( ) {
291
300
spyWarns ( )
You can’t perform that action at this time.
0 commit comments