test: test updates for d40c642
This commit is contained in:
@@ -8,7 +8,7 @@ const _hoisted_1 = {}
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
const { createVNode: _createVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"div\\", { textContent: text }, null, 8 /* PROPS */, [\\"textContent\\"]),
|
||||
|
||||
@@ -5,14 +5,14 @@ exports[`compiler: transform v-model input w/ dynamic v-bind 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", _mergeProps(obj, {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", _mergeProps(obj, {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}), null, 16 /* FULL_PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}), null, 16 /* FULL_PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelDynamic, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -22,17 +22,17 @@ exports[`compiler: transform v-model input w/ dynamic v-bind 2`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelDynamic: _vModelDynamic, resolveDirective: _resolveDirective, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _directive_bind = _resolveDirective(\\"bind\\")
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_directive_bind, val, key],
|
||||
[_vModelDynamic, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -42,19 +42,19 @@ exports[`compiler: transform v-model modifiers .lazy 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[
|
||||
_vModelText,
|
||||
model,
|
||||
void 0,
|
||||
{ lazy: true }
|
||||
]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -64,19 +64,19 @@ exports[`compiler: transform v-model modifiers .number 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[
|
||||
_vModelText,
|
||||
model,
|
||||
void 0,
|
||||
{ number: true }
|
||||
]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -86,19 +86,19 @@ exports[`compiler: transform v-model modifiers .trim 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[
|
||||
_vModelText,
|
||||
model,
|
||||
void 0,
|
||||
{ trim: true }
|
||||
]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -108,14 +108,14 @@ exports[`compiler: transform v-model simple expression 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelText, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -125,15 +125,15 @@ exports[`compiler: transform v-model simple expression for input (checkbox) 1`]
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelCheckbox: _vModelCheckbox, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelCheckbox: _vModelCheckbox, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
type: \\"checkbox\\",
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelCheckbox, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -143,17 +143,17 @@ exports[`compiler: transform v-model simple expression for input (dynamic type)
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelDynamic: _vModelDynamic, resolveDirective: _resolveDirective, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
const _directive_bind = _resolveDirective(\\"bind\\")
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_directive_bind, foo, \\"type\\"],
|
||||
[_vModelDynamic, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -163,15 +163,15 @@ exports[`compiler: transform v-model simple expression for input (radio) 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelRadio: _vModelRadio, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelRadio: _vModelRadio, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
type: \\"radio\\",
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelRadio, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -181,15 +181,15 @@ exports[`compiler: transform v-model simple expression for input (text) 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"input\\", {
|
||||
type: \\"text\\",
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelText, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -199,14 +199,14 @@ exports[`compiler: transform v-model simple expression for select 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelSelect: _vModelSelect, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelSelect: _vModelSelect, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"select\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"select\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelSelect, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -216,14 +216,14 @@ exports[`compiler: transform v-model simple expression for textarea 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"textarea\\", {
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"textarea\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), [
|
||||
}, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"])), [
|
||||
[_vModelText, model]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -5,11 +5,11 @@ exports[`compiler: v-show transform simple expression 1`] = `
|
||||
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vShow: _vShow, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const { vShow: _vShow, createVNode: _createVNode, withDirectives: _withDirectives, openBlock: _openBlock, createBlock: _createBlock } = _Vue
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"div\\", null, null, 32 /* NEED_PATCH */), [
|
||||
return _withDirectives((_openBlock(), _createBlock(\\"div\\", null, null, 32 /* NEED_PATCH */)), [
|
||||
[_vShow, a]
|
||||
]))
|
||||
])
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
CompilerOptions,
|
||||
ElementNode,
|
||||
NodeTypes,
|
||||
CallExpression
|
||||
VNodeCall
|
||||
} from '@vue/compiler-core'
|
||||
import { transformBind } from '../../../compiler-core/src/transforms/vBind'
|
||||
import { transformElement } from '../../../compiler-core/src/transforms/transformElement'
|
||||
@@ -60,7 +60,7 @@ describe('compiler: style transform', () => {
|
||||
bind: transformBind
|
||||
}
|
||||
})
|
||||
expect((node.codegenNode as CallExpression).arguments[1]).toMatchObject({
|
||||
expect((node.codegenNode as VNodeCall).props).toMatchObject({
|
||||
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
||||
properties: [
|
||||
{
|
||||
@@ -78,6 +78,6 @@ describe('compiler: style transform', () => {
|
||||
]
|
||||
})
|
||||
// should not cause the STYLE patchFlag to be attached
|
||||
expect((node.codegenNode as CallExpression).arguments.length).toBe(2)
|
||||
expect((node.codegenNode as VNodeCall).patchFlag).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -29,15 +29,13 @@ describe('compiler: v-html transform', () => {
|
||||
it('should convert v-html to innerHTML', () => {
|
||||
const ast = transformWithVHtml(`<div v-html="test"/>`)
|
||||
expect((ast.children[0] as PlainElementNode).codegenNode).toMatchObject({
|
||||
arguments: [
|
||||
`"div"`,
|
||||
createObjectMatcher({
|
||||
innerHTML: `[test]`
|
||||
}),
|
||||
`null`,
|
||||
genFlagText(PatchFlags.PROPS),
|
||||
`["innerHTML"]`
|
||||
]
|
||||
tag: `"div"`,
|
||||
props: createObjectMatcher({
|
||||
innerHTML: `[test]`
|
||||
}),
|
||||
children: undefined,
|
||||
patchFlag: genFlagText(PatchFlags.PROPS),
|
||||
dynamicProps: `["innerHTML"]`
|
||||
})
|
||||
})
|
||||
|
||||
@@ -50,15 +48,13 @@ describe('compiler: v-html transform', () => {
|
||||
[{ code: DOMErrorCodes.X_V_HTML_WITH_CHILDREN }]
|
||||
])
|
||||
expect((ast.children[0] as PlainElementNode).codegenNode).toMatchObject({
|
||||
arguments: [
|
||||
`"div"`,
|
||||
createObjectMatcher({
|
||||
innerHTML: `[test]`
|
||||
}),
|
||||
`null`, // <-- children should have been removed
|
||||
genFlagText(PatchFlags.PROPS),
|
||||
`["innerHTML"]`
|
||||
]
|
||||
tag: `"div"`,
|
||||
props: createObjectMatcher({
|
||||
innerHTML: `[test]`
|
||||
}),
|
||||
children: undefined, // <-- children should have been removed
|
||||
patchFlag: genFlagText(PatchFlags.PROPS),
|
||||
dynamicProps: `["innerHTML"]`
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
CompilerOptions,
|
||||
ElementNode,
|
||||
ObjectExpression,
|
||||
CallExpression,
|
||||
NodeTypes
|
||||
NodeTypes,
|
||||
VNodeCall
|
||||
} from '@vue/compiler-core'
|
||||
import { transformOn } from '../../src/transforms/vOn'
|
||||
import { V_ON_WITH_MODIFIERS, V_ON_WITH_KEYS } from '../../src/runtimeHelpers'
|
||||
@@ -24,8 +24,8 @@ function parseWithVOn(template: string, options: CompilerOptions = {}) {
|
||||
})
|
||||
return {
|
||||
root: ast,
|
||||
props: (((ast.children[0] as ElementNode).codegenNode as CallExpression)
|
||||
.arguments[1] as ObjectExpression).properties
|
||||
props: (((ast.children[0] as ElementNode).codegenNode as VNodeCall)
|
||||
.props as ObjectExpression).properties
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('compiler-dom: transform v-on', () => {
|
||||
})
|
||||
expect(root.cached).toBe(1)
|
||||
// should not treat cached handler as dynamicProp, so no flags
|
||||
expect((root as any).children[0].codegenNode.arguments.length).toBe(2)
|
||||
expect((root as any).children[0].codegenNode.patchFlag).toBeUndefined()
|
||||
expect(prop.value).toMatchObject({
|
||||
type: NodeTypes.JS_CACHE_EXPRESSION,
|
||||
index: 1,
|
||||
|
||||
@@ -29,15 +29,13 @@ describe('compiler: v-text transform', () => {
|
||||
it('should convert v-text to textContent', () => {
|
||||
const ast = transformWithVText(`<div v-text="test"/>`)
|
||||
expect((ast.children[0] as PlainElementNode).codegenNode).toMatchObject({
|
||||
arguments: [
|
||||
`"div"`,
|
||||
createObjectMatcher({
|
||||
textContent: `[test]`
|
||||
}),
|
||||
`null`,
|
||||
genFlagText(PatchFlags.PROPS),
|
||||
`["textContent"]`
|
||||
]
|
||||
tag: `"div"`,
|
||||
props: createObjectMatcher({
|
||||
textContent: `[test]`
|
||||
}),
|
||||
children: undefined,
|
||||
patchFlag: genFlagText(PatchFlags.PROPS),
|
||||
dynamicProps: `["textContent"]`
|
||||
})
|
||||
})
|
||||
|
||||
@@ -50,15 +48,13 @@ describe('compiler: v-text transform', () => {
|
||||
[{ code: DOMErrorCodes.X_V_TEXT_WITH_CHILDREN }]
|
||||
])
|
||||
expect((ast.children[0] as PlainElementNode).codegenNode).toMatchObject({
|
||||
arguments: [
|
||||
`"div"`,
|
||||
createObjectMatcher({
|
||||
textContent: `[test]`
|
||||
}),
|
||||
`null`, // <-- children should have been removed
|
||||
genFlagText(PatchFlags.PROPS),
|
||||
`["textContent"]`
|
||||
]
|
||||
tag: `"div"`,
|
||||
props: createObjectMatcher({
|
||||
textContent: `[test]`
|
||||
}),
|
||||
children: undefined, // <-- children should have been removed
|
||||
patchFlag: genFlagText(PatchFlags.PROPS),
|
||||
dynamicProps: `["textContent"]`
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user