@@ -968,6 +968,25 @@ describe "JavaScript grammar", ->
968968 expect ( tokens [ 5 ] ) . toEqual value: '}' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'source.js.embedded.source' , 'punctuation.section.embedded.js' ]
969969 expect ( tokens [ 6 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'punctuation.definition.string.end.js' ]
970970
971+ describe "ES6 tagged HBS string templates" , - >
972+ it "tokenizes them as strings" , - >
973+ { tokens} = grammar . tokenizeLine ( 'hbs`{{#if isAdmin`' )
974+ expect ( tokens [ 0 ] ) . toEqual value: 'hbs' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'entity.name.function.js' ]
975+ expect ( tokens [ 1 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'punctuation.definition.string.begin.js' ]
976+ expect ( tokens [ 2 ] ) . toEqual value: '{{#if isAdmin' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' ]
977+ expect ( tokens [ 3 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'punctuation.definition.string.end.js' ]
978+
979+ describe "ES6 tagged HBS string templates with interpolation" , - >
980+ it "tokenizes them as strings" , - >
981+ { tokens} = grammar . tokenizeLine ( 'hbs`{{#if ${isAdmin}`' )
982+ expect ( tokens [ 0 ] ) . toEqual value: 'hbs' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'entity.name.function.js' ]
983+ expect ( tokens [ 1 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'punctuation.definition.string.begin.js' ]
984+ expect ( tokens [ 2 ] ) . toEqual value: '{{#if ' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' ]
985+ expect ( tokens [ 3 ] ) . toEqual value: '${' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'source.js.embedded.source' , 'punctuation.section.embedded.js' ]
986+ expect ( tokens [ 4 ] ) . toEqual value: 'isAdmin' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'source.js.embedded.source' ]
987+ expect ( tokens [ 5 ] ) . toEqual value: '}' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'source.js.embedded.source' , 'punctuation.section.embedded.js' ]
988+ expect ( tokens [ 6 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.hbs.js' , 'punctuation.definition.string.end.js' ]
989+
971990 describe "ES6 class" , - >
972991 it "tokenizes class" , - >
973992 { tokens} = grammar . tokenizeLine ( 'class MyClass' )
0 commit comments