refactor(ssr): adjust helper structure + renderList

This commit is contained in:
Evan You
2020-02-03 18:16:09 -05:00
parent 889a0276eb
commit 2ad0eed5cd
9 changed files with 90 additions and 45 deletions

View File

@@ -1,16 +1,16 @@
import { _interpolate } from '../src'
import { interpolate } from '../src/helpers/interpolate'
import { escapeHtml } from '@vue/shared'
test('ssr: interpolate', () => {
expect(_interpolate(0)).toBe(`0`)
expect(_interpolate(`foo`)).toBe(`foo`)
expect(_interpolate(`<div>`)).toBe(`&lt;div&gt;`)
expect(interpolate(0)).toBe(`0`)
expect(interpolate(`foo`)).toBe(`foo`)
expect(interpolate(`<div>`)).toBe(`&lt;div&gt;`)
// should escape interpolated values
expect(_interpolate([1, 2, 3])).toBe(
expect(interpolate([1, 2, 3])).toBe(
escapeHtml(JSON.stringify([1, 2, 3], null, 2))
)
expect(
_interpolate({
interpolate({
foo: 1,
bar: `<div>`
})