|
@@ -6,6 +6,21 @@ describe('ssr: text', () => {
|
|
|
expect(getCompiledString(`foo`)).toMatchInlineSnapshot(`"\`foo\`"`)
|
|
expect(getCompiledString(`foo`)).toMatchInlineSnapshot(`"\`foo\`"`)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ test('static text with template string special chars', () => {
|
|
|
|
|
+ expect(getCompiledString(`\`\${foo}\``)).toMatchInlineSnapshot(
|
|
|
|
|
+ `"\`\\\\\`\\\\\${foo}\\\\\`\`"`
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test('static text with char escape', () => {
|
|
|
|
|
+ // the desired generated code should be `\\\$foo`
|
|
|
|
|
+ // snapshot -> inline snapshot goes through two escapes
|
|
|
|
|
+ // so that makes a total of 3 * 2 * 2 = 12 back slashes
|
|
|
|
|
+ expect(getCompiledString(`\\$foo`)).toMatchInlineSnapshot(
|
|
|
|
|
+ `"\`\\\\\\\\\\\\$foo\`"`
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
test('comments', () => {
|
|
test('comments', () => {
|
|
|
expect(getCompiledString(`<!--bar-->`)).toMatchInlineSnapshot(
|
|
expect(getCompiledString(`<!--bar-->`)).toMatchInlineSnapshot(
|
|
|
`"\`<!--bar-->\`"`
|
|
`"\`<!--bar-->\`"`
|