wip(vitest-migration): compiler-dom tests passing

This commit is contained in:
Evan You 2023-01-26 16:48:19 +08:00
parent 5804406fac
commit 8599242bb4
8 changed files with 109 additions and 96 deletions

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compile should contain standard transforms 1`] = ` exports[`compile > should contain standard transforms 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -8,13 +8,13 @@ return function render(_ctx, _cache) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, normalizeStyle: _normalizeStyle, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, normalizeStyle: _normalizeStyle, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode("div", { _createElementVNode(\\"div\\", {
textContent: _toDisplayString(text) textContent: _toDisplayString(text)
}, null, 8 /* PROPS */, ["textContent"]), }, null, 8 /* PROPS */, [\\"textContent\\"]),
_createElementVNode("div", { innerHTML: html }, null, 8 /* PROPS */, ["innerHTML"]), _createElementVNode(\\"div\\", { innerHTML: html }, null, 8 /* PROPS */, [\\"innerHTML\\"]),
_createElementVNode("div", null, "test"), _createElementVNode(\\"div\\", null, \\"test\\"),
_createElementVNode("div", { style: {"color":"red"} }, "red"), _createElementVNode(\\"div\\", { style: {\\"color\\":\\"red\\"} }, \\"red\\"),
_createElementVNode("div", { _createElementVNode(\\"div\\", {
style: _normalizeStyle({color: 'green'}) style: _normalizeStyle({color: 'green'})
}, null, 4 /* STYLE */) }, null, 4 /* STYLE */)
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))

View File

@ -1,3 +1,6 @@
/**
* @vitest-environment jsdom
*/
import { decodeHtmlBrowser } from '../src/decodeHtmlBrowser' import { decodeHtmlBrowser } from '../src/decodeHtmlBrowser'
describe('decodeHtmlBrowser', () => { describe('decodeHtmlBrowser', () => {

View File

@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`inject persisted when child has v-show 1`] = ` exports[`inject persisted when child has v-show 1`] = `
"const _Vue = Vue "const _Vue = Vue
@ -7,9 +7,9 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vShow: _vShow, createElementVNode: _createElementVNode, withDirectives: _withDirectives, Transition: _Transition, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue const { vShow: _vShow, createElementVNode: _createElementVNode, withDirectives: _withDirectives, Transition: _Transition, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
return (_openBlock(), _createBlock(_Transition, { persisted: "" }, { return (_openBlock(), _createBlock(_Transition, { persisted: \\"\\" }, {
default: _withCtx(() => [ default: _withCtx(() => [
_withDirectives(_createElementVNode("div", null, null, 512 /* NEED_PATCH */), [ _withDirectives(_createElementVNode(\\"div\\", null, null, 512 /* NEED_PATCH */), [
[_vShow, ok] [_vShow, ok]
]) ])
]), ]),
@ -29,15 +29,15 @@ return function render(_ctx, _cache) {
return (_openBlock(), _createBlock(_Transition, null, { return (_openBlock(), _createBlock(_Transition, null, {
default: _withCtx(() => [ default: _withCtx(() => [
a a
? (_openBlock(), _createElementBlock("div", { key: 0 }, "hey")) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, \\"hey\\"))
: b : b
? (_openBlock(), _createElementBlock("div", { key: 1 }, "hey")) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 1 }, \\"hey\\"))
: (_openBlock(), _createElementBlock("div", { key: 2 }, [ : (_openBlock(), _createElementBlock(\\"div\\", { key: 2 }, [
c c
? (_openBlock(), _createElementBlock("p", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"p\\", { key: 0 }))
: (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
_createCommentVNode(" this should not be ignored "), _createCommentVNode(\\" this should not be ignored \\"),
_createElementVNode("p") _createElementVNode(\\"p\\")
], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */)) ], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))
])) ]))
]), ]),

View File

@ -1,52 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`stringify static html should bail on bindings that are hoisted but not stringifiable 1`] = ` exports[`stringify static html > should bail on bindings that are hoisted but not stringifiable 1`] = `
"const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue "const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("div", null, [ const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"div\\", null, [
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"), /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"), /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"), /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"), /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"), /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode("img", { src: _imports_0_ }) /*#__PURE__*/_createElementVNode(\\"img\\", { src: _imports_0_ })
], -1 /* HOISTED */) ], -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
}" }"
`; `;
exports[`stringify static html should work with bindings that are non-static but stringifiable 1`] = ` exports[`stringify static html > should work with bindings that are non-static but stringifiable 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue "const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<div><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><img src=\\"" + _imports_0_ + "\\"></div>", 1) const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<div><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><img src=\\\\\\"\\" + _imports_0_ + \\"\\\\\\"></div>\\", 1)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
}" }"
`; `;
exports[`stringify static html stringify v-html 1`] = ` exports[`stringify static html > stringify v-html 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue "const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<pre data-type=\\"js\\"><code><span>show-it </span></code></pre><div class><span class>1</span><span class>2</span></div>", 2) const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<pre data-type=\\\\\\"js\\\\\\"><code><span>show-it </span></code></pre><div class><span class>1</span><span class>2</span></div>\\", 2)
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return _hoisted_1 return _hoisted_1
}" }"
`; `;
exports[`stringify static html stringify v-text 1`] = ` exports[`stringify static html > stringify v-text 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue "const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<pre data-type=\\"js\\"><code>&lt;span&gt;show-it &lt;/span&gt;</code></pre><div class><span class>1</span><span class>2</span></div>", 2) const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<pre data-type=\\\\\\"js\\\\\\"><code>&lt;span&gt;show-it &lt;/span&gt;</code></pre><div class><span class>1</span><span class>2</span></div>\\", 2)
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return _hoisted_1 return _hoisted_1

View File

@ -1,63 +1,63 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: transform v-model errors should allow usage on custom element 1`] = ` exports[`compiler: transform v-model > errors > should allow usage on custom element 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("my-input", { return _withDirectives((_openBlock(), _createElementBlock(\\"my-input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelText, model] [_vModelText, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model input w/ dynamic v-bind 1`] = ` exports[`compiler: transform v-model > input w/ dynamic v-bind 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", _mergeProps(obj, { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", _mergeProps(obj, {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}), null, 16 /* FULL_PROPS */, ["onUpdate:modelValue"])), [ }), null, 16 /* FULL_PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelDynamic, model] [_vModelDynamic, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model input w/ dynamic v-bind 2`] = ` exports[`compiler: transform v-model > input w/ dynamic v-bind 2`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelDynamic: _vModelDynamic, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelDynamic: _vModelDynamic, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelDynamic, model] [_vModelDynamic, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model modifiers .lazy 1`] = ` exports[`compiler: transform v-model > modifiers > .lazy 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[ [
_vModelText, _vModelText,
model, model,
@ -69,16 +69,16 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform v-model modifiers .number 1`] = ` exports[`compiler: transform v-model > modifiers > .number 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[ [
_vModelText, _vModelText,
model, model,
@ -90,16 +90,16 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform v-model modifiers .trim 1`] = ` exports[`compiler: transform v-model > modifiers > .trim 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[ [
_vModelText, _vModelText,
model, model,
@ -111,115 +111,115 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform v-model simple expression 1`] = ` exports[`compiler: transform v-model > simple expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelText, model] [_vModelText, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for input (checkbox) 1`] = ` exports[`compiler: transform v-model > simple expression for input (checkbox) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelCheckbox: _vModelCheckbox, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelCheckbox: _vModelCheckbox, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
type: "checkbox", type: \\"checkbox\\",
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelCheckbox, model] [_vModelCheckbox, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for input (dynamic type) 1`] = ` exports[`compiler: transform v-model > simple expression for input (dynamic type) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelDynamic: _vModelDynamic, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelDynamic: _vModelDynamic, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelDynamic, model] [_vModelDynamic, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for input (radio) 1`] = ` exports[`compiler: transform v-model > simple expression for input (radio) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelRadio: _vModelRadio, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelRadio: _vModelRadio, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
type: "radio", type: \\"radio\\",
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelRadio, model] [_vModelRadio, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for input (text) 1`] = ` exports[`compiler: transform v-model > simple expression for input (text) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("input", { return _withDirectives((_openBlock(), _createElementBlock(\\"input\\", {
type: "text", type: \\"text\\",
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelText, model] [_vModelText, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for select 1`] = ` exports[`compiler: transform v-model > simple expression for select 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelSelect: _vModelSelect, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelSelect: _vModelSelect, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("select", { return _withDirectives((_openBlock(), _createElementBlock(\\"select\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelSelect, model] [_vModelSelect, model]
]) ])
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression for textarea 1`] = ` exports[`compiler: transform v-model > simple expression for textarea 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("textarea", { return _withDirectives((_openBlock(), _createElementBlock(\\"textarea\\", {
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["onUpdate:modelValue"])), [ }, null, 8 /* PROPS */, [\\"onUpdate:modelValue\\"])), [
[_vModelText, model] [_vModelText, model]
]) ])
} }

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: v-show transform simple expression 1`] = ` exports[`compiler: v-show transform > simple expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { vShow: _vShow, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { vShow: _vShow, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return _withDirectives((_openBlock(), _createElementBlock("div", null, null, 512 /* NEED_PATCH */)), [ return _withDirectives((_openBlock(), _createElementBlock(\\"div\\", null, null, 512 /* NEED_PATCH */)), [
[_vShow, a] [_vShow, a]
]) ])
} }

View File

@ -21,7 +21,7 @@ export function createDOMCompilerError(
} }
export const enum DOMErrorCodes { export const enum DOMErrorCodes {
X_V_HTML_NO_EXPRESSION = ErrorCodes.__EXTEND_POINT__, X_V_HTML_NO_EXPRESSION = 51 /* ErrorCodes.__EXTEND_POINT__ */,
X_V_HTML_WITH_CHILDREN, X_V_HTML_WITH_CHILDREN,
X_V_TEXT_NO_EXPRESSION, X_V_TEXT_NO_EXPRESSION,
X_V_TEXT_WITH_CHILDREN, X_V_TEXT_WITH_CHILDREN,
@ -35,6 +35,17 @@ export const enum DOMErrorCodes {
__EXTEND_POINT__ __EXTEND_POINT__
} }
if (__TEST__) {
// esbuild cannot infer const enum increments if first value is from another
// file, so we have to manually keep them in sync. this check ensures it
// errors out if there are collisions.
if (DOMErrorCodes.X_V_HTML_NO_EXPRESSION < ErrorCodes.__EXTEND_POINT__) {
throw new Error(
'DOMErrorCodes need to be updated to match extension point from core ErrorCodes.'
)
}
}
export const DOMErrorMessages: { [code: number]: string } = { export const DOMErrorMessages: { [code: number]: string } = {
[DOMErrorCodes.X_V_HTML_NO_EXPRESSION]: `v-html is missing expression.`, [DOMErrorCodes.X_V_HTML_NO_EXPRESSION]: `v-html is missing expression.`,
[DOMErrorCodes.X_V_HTML_WITH_CHILDREN]: `v-html will override element children.`, [DOMErrorCodes.X_V_HTML_WITH_CHILDREN]: `v-html will override element children.`,

View File

@ -2,7 +2,6 @@ import {
TextModes, TextModes,
ParserOptions, ParserOptions,
ElementNode, ElementNode,
Namespaces,
NodeTypes, NodeTypes,
isBuiltInType isBuiltInType
} from '@vue/compiler-core' } from '@vue/compiler-core'
@ -17,7 +16,7 @@ const isRawTextContainer = /*#__PURE__*/ makeMap(
) )
export const enum DOMNamespaces { export const enum DOMNamespaces {
HTML = Namespaces.HTML, HTML = 0 /* Namespaces.HTML */,
SVG, SVG,
MATH_ML MATH_ML
} }