refactor(ssr): move escapeHtml to shared

This commit is contained in:
Evan You
2020-02-02 22:08:20 -05:00
parent 327670a034
commit d1eed36452
10 changed files with 37 additions and 24 deletions

View File

@@ -1,10 +1,10 @@
import { compile } from '../../src'
import { compile } from '../src'
function getElementString(src: string): string {
return compile(src).code.match(/_push\((.*)\)/)![1]
}
describe('ssr transform element', () => {
describe('ssr compile integration test', () => {
test('basic elements', () => {
expect(getElementString(`<div></div>`)).toMatchInlineSnapshot(
`"\`<div></div>\`"`
@@ -22,4 +22,12 @@ describe('ssr transform element', () => {
getElementString(`<div><span></span><span></span></div>`)
).toMatchInlineSnapshot(`"\`<div><span></span><span></span></div>\`"`)
})
test('nested elements with static text', () => {
expect(
getElementString(`<div><span>hello</span>&gt;<span>bye</span></div>`)
).toMatchInlineSnapshot(
`"\`<div><span>hello</span>&gt;<span>bye</span></div>\`"`
)
})
})