test: update tests and snapshots for helper prefixing

This commit is contained in:
Evan You
2020-02-07 19:04:55 -05:00
parent 51317af6e8
commit 8b2d6a35d0
22 changed files with 293 additions and 257 deletions

View File

@@ -18,8 +18,8 @@ describe('scopeId compiler support', () => {
scopeId: 'test'
})
expect(ast.helpers).toContain(WITH_SCOPE_ID)
expect(code).toMatch(`const withId = withScopeId("test")`)
expect(code).toMatch(`export const render = withId(function render() {`)
expect(code).toMatch(`const _withId = _withScopeId("test")`)
expect(code).toMatch(`export const render = _withId(function render() {`)
expect(code).toMatchSnapshot()
})
@@ -28,7 +28,7 @@ describe('scopeId compiler support', () => {
mode: 'module',
scopeId: 'test'
})
expect(code).toMatch(`default: withId(() => [`)
expect(code).toMatch(`default: _withId(() => [`)
expect(code).toMatchSnapshot()
})
@@ -44,8 +44,8 @@ describe('scopeId compiler support', () => {
scopeId: 'test'
}
)
expect(code).toMatch(`foo: withId(({ msg }) => [`)
expect(code).toMatch(`bar: withId(() => [`)
expect(code).toMatch(`foo: _withId(({ msg }) => [`)
expect(code).toMatch(`bar: _withId(() => [`)
expect(code).toMatchSnapshot()
})
@@ -61,8 +61,8 @@ describe('scopeId compiler support', () => {
scopeId: 'test'
}
)
expect(code).toMatch(/name: "foo",\s+fn: withId\(/)
expect(code).toMatch(/name: i,\s+fn: withId\(/)
expect(code).toMatch(/name: "foo",\s+fn: _withId\(/)
expect(code).toMatch(/name: i,\s+fn: _withId\(/)
expect(code).toMatchSnapshot()
})
@@ -80,10 +80,10 @@ describe('scopeId compiler support', () => {
expect(ast.hoists.length).toBe(2)
expect(code).toMatch(
[
`pushScopeId("test")`,
`const _hoisted_1 = createVNode("div", null, "hello")`,
`const _hoisted_2 = createVNode("div", null, "world")`,
`popScopeId()`
`_pushScopeId("test")`,
`const _hoisted_1 = _createVNode("div", null, "hello")`,
`const _hoisted_2 = _createVNode("div", null, "world")`,
`_popScopeId()`
].join('\n')
)
expect(code).toMatchSnapshot()