wip(ssr): adjust event hydration flag
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
exports[`compiler: codegen ArrayExpression 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return [
|
||||
foo,
|
||||
bar(baz)
|
||||
@@ -34,7 +34,7 @@ export function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen ConditionalExpression 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return ok
|
||||
? foo()
|
||||
: orNot
|
||||
@@ -47,7 +47,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen Element (callExpression + objectExpression + TemplateChildNode[]) 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return _createVNode(\\"div\\", {
|
||||
id: \\"foo\\",
|
||||
[prop]: bar,
|
||||
@@ -62,7 +62,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen assets + temps 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const _component_Foo = _resolveComponent(\\"Foo\\")
|
||||
const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
|
||||
const _component_barbaz = _resolveComponent(\\"barbaz\\")
|
||||
@@ -78,7 +78,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen comment 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return _createCommentVNode(\\"foo\\")
|
||||
}
|
||||
}"
|
||||
@@ -87,7 +87,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen compound expression 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return _ctx.foo + _toDisplayString(bar) + nested
|
||||
}
|
||||
}"
|
||||
@@ -96,7 +96,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen forNode 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(), 1))
|
||||
}
|
||||
}"
|
||||
@@ -106,7 +106,7 @@ exports[`compiler: codegen function mode preamble 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, resolveDirective: _resolveDirective } = _Vue
|
||||
|
||||
return null
|
||||
@@ -128,7 +128,7 @@ const _hoisted_1 = hello
|
||||
const _hoisted_2 = { id: \\"foo\\" }
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return null
|
||||
}
|
||||
}"
|
||||
@@ -137,7 +137,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen ifNode 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return foo
|
||||
? bar
|
||||
: baz
|
||||
@@ -148,7 +148,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen interpolation 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return _toDisplayString(hello)
|
||||
}
|
||||
}"
|
||||
@@ -176,7 +176,7 @@ export function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen static text 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return \\"hello\\"
|
||||
}
|
||||
}"
|
||||
@@ -185,7 +185,7 @@ return function render(_ctx, _cache) {
|
||||
exports[`compiler: codegen temps 1`] = `
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
let _temp0, _temp1, _temp2
|
||||
|
||||
return null
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`compiler: integration tests function mode 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", {
|
||||
|
||||
@@ -5,8 +5,8 @@ exports[`scopeId compiler support should push scopeId for hoisted nodes 1`] = `
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
_pushScopeId(\\"test\\")
|
||||
const _hoisted_1 = _createVNode(\\"div\\", null, \\"hello\\", -2 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"div\\", null, \\"world\\", -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"div\\", null, \\"hello\\", -1 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"div\\", null, \\"world\\", -1 /* HOISTED */)
|
||||
_popScopeId()
|
||||
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
@@ -58,7 +58,7 @@ export const render = _withId(function render(_ctx, _cache) {
|
||||
])
|
||||
}
|
||||
})
|
||||
]), 512 /* DYNAMIC_SLOTS */))
|
||||
]), 1024 /* DYNAMIC_SLOTS */))
|
||||
})"
|
||||
`;
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ describe('compiler: codegen', () => {
|
||||
expect(code).toMatchInlineSnapshot(`
|
||||
"
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
return foo = bar
|
||||
}
|
||||
}"
|
||||
@@ -602,7 +602,7 @@ describe('compiler: codegen', () => {
|
||||
createRoot({
|
||||
codegenNode: node
|
||||
})
|
||||
).code.match(/with \(this\) \{\s+([^]+)\s+\}\s+\}$/)![1]
|
||||
).code.match(/with \(_ctx\) \{\s+([^]+)\s+\}\s+\}$/)![1]
|
||||
}
|
||||
|
||||
const mockProps = createObjectExpression([
|
||||
|
||||
@@ -4,10 +4,10 @@ exports[`compiler: hoistStatic transform hoist element with static key 1`] = `
|
||||
"const _Vue = Vue
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"div\\", { key: \\"foo\\" }, null, -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"div\\", { key: \\"foo\\" }, null, -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -24,10 +24,10 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = _createVNode(\\"p\\", null, [
|
||||
_createVNode(\\"span\\"),
|
||||
_createVNode(\\"span\\")
|
||||
], -2 /* HOISTED */)
|
||||
], -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -43,10 +43,10 @@ const { createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"div\\", null, [
|
||||
_createCommentVNode(\\"comment\\")
|
||||
], -2 /* HOISTED */)
|
||||
], -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createCommentVNode: _createCommentVNode, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -60,11 +60,11 @@ exports[`compiler: hoistStatic transform hoist siblings with common non-hoistabl
|
||||
"const _Vue = Vue
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", null, null, -2 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"div\\", null, null, -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"span\\", null, null, -1 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"div\\", null, null, -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -79,10 +79,10 @@ exports[`compiler: hoistStatic transform hoist simple element 1`] = `
|
||||
"const _Vue = Vue
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\", -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\", -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -99,13 +99,13 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { resolveDirective: _resolveDirective, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _directive_foo = _resolveDirective(\\"foo\\")
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_withDirectives(_createVNode(\\"div\\", _hoisted_1, null, -1 /* NEED_PATCH */), [
|
||||
_withDirectives(_createVNode(\\"div\\", _hoisted_1, null, 512 /* NEED_PATCH */), [
|
||||
[_directive_foo]
|
||||
])
|
||||
]))
|
||||
@@ -120,7 +120,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -137,7 +137,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -158,7 +158,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = { class: { foo: true } }
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -172,10 +172,10 @@ exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static t
|
||||
"const _Vue = Vue
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", null, \\"foo \\" + _toDisplayString(1) + \\" \\" + _toDisplayString(true), -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"span\\", null, \\"foo \\" + _toDisplayString(1) + \\" \\" + _toDisplayString(true), -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -189,10 +189,10 @@ exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static t
|
||||
"const _Vue = Vue
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1), -2 /* HOISTED */)
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1), -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -220,7 +220,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -238,7 +238,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -257,7 +257,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -275,7 +275,7 @@ exports[`compiler: hoistStatic transform should NOT hoist components 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -291,7 +291,7 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic k
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -305,7 +305,7 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic p
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -319,11 +319,11 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic r
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", { ref: foo }, null, -1 /* NEED_PATCH */)
|
||||
_createVNode(\\"div\\", { ref: foo }, null, 512 /* NEED_PATCH */)
|
||||
]))
|
||||
}
|
||||
}"
|
||||
@@ -333,7 +333,7 @@ exports[`compiler: hoistStatic transform should NOT hoist root node 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\"))
|
||||
@@ -346,10 +346,10 @@ exports[`compiler: hoistStatic transform should hoist v-for children if static 1
|
||||
const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
const _hoisted_2 = _createVNode(\\"span\\", null, null, -2 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"span\\", null, null, -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -371,10 +371,10 @@ const _hoisted_1 = {
|
||||
key: 0,
|
||||
id: \\"foo\\"
|
||||
}
|
||||
const _hoisted_2 = _createVNode(\\"span\\", null, null, -2 /* HOISTED */)
|
||||
const _hoisted_2 = _createVNode(\\"span\\", null, null, -1 /* HOISTED */)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`compiler: transform text <template v-for> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(list, (i) => {
|
||||
@@ -20,7 +20,7 @@ exports[`compiler: transform text consecutive text 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
return _toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz)
|
||||
@@ -32,7 +32,7 @@ exports[`compiler: transform text consecutive text between elements 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
@@ -48,7 +48,7 @@ exports[`compiler: transform text consecutive text mixed with elements 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
@@ -66,7 +66,7 @@ exports[`compiler: transform text no consecutive text 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
return _toDisplayString(foo)
|
||||
@@ -78,7 +78,7 @@ exports[`compiler: transform text text between elements (static) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`compiler: v-for codegen basic v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -18,7 +18,7 @@ exports[`compiler: v-for codegen keyed template v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -35,7 +35,7 @@ exports[`compiler: v-for codegen keyed v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -49,7 +49,7 @@ exports[`compiler: v-for codegen skipped key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item, __, index) => {
|
||||
@@ -63,7 +63,7 @@ exports[`compiler: v-for codegen skipped value & key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (_, __, index) => {
|
||||
@@ -77,7 +77,7 @@ exports[`compiler: v-for codegen skipped value 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (_, key, index) => {
|
||||
@@ -91,7 +91,7 @@ exports[`compiler: v-for codegen template v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -108,7 +108,7 @@ exports[`compiler: v-for codegen template v-for w/ <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -122,7 +122,7 @@ exports[`compiler: v-for codegen v-for on <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
@@ -136,13 +136,13 @@ exports[`compiler: v-for codegen v-for on element with custom directive 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, resolveDirective: _resolveDirective, createVNode: _createVNode, withDirectives: _withDirectives } = _Vue
|
||||
|
||||
const _directive_foo = _resolveDirective(\\"foo\\")
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(list, (i) => {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"div\\", null, null, -1 /* NEED_PATCH */)), [
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"div\\", null, null, 512 /* NEED_PATCH */)), [
|
||||
[_directive_foo]
|
||||
])
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@@ -154,7 +154,7 @@ exports[`compiler: v-for codegen v-if + v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -170,7 +170,7 @@ exports[`compiler: v-for codegen value + key + index 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createVNode: _createVNode } = _Vue
|
||||
|
||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item, key, index) => {
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`compiler: v-if codegen basic v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -18,7 +18,7 @@ exports[`compiler: v-if codegen template v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -36,7 +36,7 @@ exports[`compiler: v-if codegen template v-if w/ single <slot/> child 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -50,7 +50,7 @@ exports[`compiler: v-if codegen v-if + v-else 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -64,7 +64,7 @@ exports[`compiler: v-if codegen v-if + v-else-if + v-else 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -80,7 +80,7 @@ exports[`compiler: v-if codegen v-if + v-else-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -96,7 +96,7 @@ exports[`compiler: v-if codegen v-if on <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
@@ -110,7 +110,7 @@ exports[`compiler: v-if codegen v-if with key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
return ok
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`compiler: transform v-model compound expression 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
@@ -41,7 +41,7 @@ exports[`compiler: transform v-model simple exprssion 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
@@ -56,13 +56,13 @@ exports[`compiler: transform v-model with argument 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
value: model,
|
||||
\\"onUpdate:value\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"value\\", \\"onUpdate:value\\"]))
|
||||
}, null, 40 /* PROPS, HYDRATE_EVENTS */, [\\"value\\", \\"onUpdate:value\\"]))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -82,7 +82,7 @@ exports[`compiler: transform v-model with dynamic argument 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`compiler: v-once transform as root node 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode } = _Vue
|
||||
|
||||
return _cache[1] || (
|
||||
@@ -21,7 +21,7 @@ exports[`compiler: v-once transform on component 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -42,7 +42,7 @@ exports[`compiler: v-once transform on nested plain element 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -61,7 +61,7 @@ exports[`compiler: v-once transform on slot outlet 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@@ -80,7 +80,7 @@ exports[`compiler: v-once transform with hoistStatic: true 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
|
||||
@@ -10,7 +10,7 @@ return function render(_ctx, _cache) {
|
||||
[_ctx.one]: ({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)],
|
||||
[_ctx.two]: ({ bar }) => [_toDisplayString(_ctx.foo), _toDisplayString(bar)],
|
||||
_: 1
|
||||
}, 512 /* DYNAMIC_SLOTS */))
|
||||
}, 1024 /* DYNAMIC_SLOTS */))
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -42,7 +42,7 @@ return function render(_ctx, _cache) {
|
||||
fn: () => [_toDisplayString(name)]
|
||||
}
|
||||
})
|
||||
]), 512 /* DYNAMIC_SLOTS */))
|
||||
]), 1024 /* DYNAMIC_SLOTS */))
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -59,7 +59,7 @@ return function render(_ctx, _cache) {
|
||||
fn: (props) => [_toDisplayString(props)]
|
||||
}
|
||||
: undefined
|
||||
]), 512 /* DYNAMIC_SLOTS */))
|
||||
]), 1024 /* DYNAMIC_SLOTS */))
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -67,7 +67,7 @@ exports[`compiler: transform component slots named slot with v-if + v-else-if +
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -87,7 +87,7 @@ return function render(_ctx, _cache) {
|
||||
name: \\"one\\",
|
||||
fn: () => [\\"baz\\"]
|
||||
}
|
||||
]), 512 /* DYNAMIC_SLOTS */))
|
||||
]), 1024 /* DYNAMIC_SLOTS */))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -96,7 +96,7 @@ exports[`compiler: transform component slots named slot with v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -108,7 +108,7 @@ return function render(_ctx, _cache) {
|
||||
fn: () => [\\"hello\\"]
|
||||
}
|
||||
: undefined
|
||||
]), 512 /* DYNAMIC_SLOTS */))
|
||||
]), 1024 /* DYNAMIC_SLOTS */))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -131,7 +131,7 @@ exports[`compiler: transform component slots named slots w/ implicit default slo
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
with (_ctx) {
|
||||
const { createVNode: _createVNode, resolveComponent: _resolveComponent, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
@@ -160,7 +160,7 @@ return function render(_ctx, _cache) {
|
||||
_createVNode(_component_Inner, null, {
|
||||
default: ({ bar }) => [_toDisplayString(foo), _toDisplayString(bar), _toDisplayString(_ctx.baz)],
|
||||
_: 1
|
||||
}, 512 /* DYNAMIC_SLOTS */),
|
||||
}, 1024 /* DYNAMIC_SLOTS */),
|
||||
\\" \\",
|
||||
_toDisplayString(foo),
|
||||
_toDisplayString(_ctx.bar),
|
||||
|
||||
@@ -770,6 +770,29 @@ describe('compiler: element transform', () => {
|
||||
const { node } = parseWithBind(`<div v-foo />`)
|
||||
expect(node.patchFlag).toBe(genFlagText(PatchFlags.NEED_PATCH))
|
||||
})
|
||||
|
||||
test('HYDRATE_EVENTS', () => {
|
||||
// ignore click events (has dedicated fast path)
|
||||
const { node } = parseWithElementTransform(`<div @click="foo" />`, {
|
||||
directiveTransforms: {
|
||||
on: transformOn
|
||||
}
|
||||
})
|
||||
// should only have props flag
|
||||
expect(node.patchFlag).toBe(genFlagText(PatchFlags.PROPS))
|
||||
|
||||
const { node: node2 } = parseWithElementTransform(
|
||||
`<div @keyup="foo" />`,
|
||||
{
|
||||
directiveTransforms: {
|
||||
on: transformOn
|
||||
}
|
||||
}
|
||||
)
|
||||
expect(node2.patchFlag).toBe(
|
||||
genFlagText([PatchFlags.PROPS, PatchFlags.HYDRATE_EVENTS])
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('dynamic component', () => {
|
||||
|
||||
Reference in New Issue
Block a user