mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-04-24 10:32:33 +08:00
290 lines
9.8 KiB
Plaintext
290 lines
9.8 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`MereProps Order: MereProps Order 1`] = `
|
|
"import { createVNode as _createVNode, mergeProps as _mergeProps, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"button\\", _mergeProps({
|
|
\\"loading\\": true
|
|
}, x, {
|
|
\\"type\\": \\"submit\\"
|
|
}), [_createTextVNode(\\"btn\\")], 16, [\\"loading\\"]);"
|
|
`;
|
|
|
|
exports[`Merge class/ style attributes into array: Merge class/ style attributes into array 1`] = `
|
|
"import { createVNode as _createVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"div\\", {
|
|
\\"class\\": [\\"a\\", b],
|
|
\\"style\\": [\\"color: red\\", s]
|
|
}, null, 6);"
|
|
`;
|
|
|
|
exports[`Without JSX should work: Without JSX should work 1`] = `
|
|
"import { createVNode } from 'vue';
|
|
createVNode('div', null, ['Without JSX should work']);"
|
|
`;
|
|
|
|
exports[`Without props: Without props 1`] = `
|
|
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"a\\", null, [_createTextVNode(\\"a\\")]);"
|
|
`;
|
|
|
|
exports[`custom directive: custom directive 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, resolveDirective as _resolveDirective, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"cus\\"), x]]);"
|
|
`;
|
|
|
|
exports[`disable object slot syntax with defaultSlot: defaultSlot 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"Badge\\"), null, {
|
|
default: () => [slots.default()],
|
|
_: 1
|
|
});"
|
|
`;
|
|
|
|
exports[`dynamic type in input: dynamic type in input 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelDynamic as _vModelDynamic } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"input\\", {
|
|
\\"type\\": type,
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, null, 8, [\\"type\\", \\"onUpdate:modelValue\\"]), [[_vModelDynamic, test]]);"
|
|
`;
|
|
|
|
exports[`input[type="checkbox"]: input[type="checkbox"] 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelCheckbox as _vModelCheckbox } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"input\\", {
|
|
\\"type\\": \\"checkbox\\",
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelCheckbox, test]]);"
|
|
`;
|
|
|
|
exports[`input[type="radio"]: input[type="radio"] 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelRadio as _vModelRadio, Fragment as _Fragment } from \\"vue\\";
|
|
|
|
_createVNode(_Fragment, null, [_withDirectives(_createVNode(\\"input\\", {
|
|
\\"type\\": \\"radio\\",
|
|
\\"value\\": \\"1\\",
|
|
\\"onUpdate:modelValue\\": $event => test = $event,
|
|
\\"name\\": \\"test\\"
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelRadio, test]]), _withDirectives(_createVNode(\\"input\\", {
|
|
\\"type\\": \\"radio\\",
|
|
\\"value\\": \\"2\\",
|
|
\\"onUpdate:modelValue\\": $event => test = $event,
|
|
\\"name\\": \\"test\\"
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelRadio, test]])]);"
|
|
`;
|
|
|
|
exports[`input[type="text"] .lazy modifier: input[type="text"] .lazy modifier 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelText as _vModelText } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"input\\", {
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test, void 0, {
|
|
lazy: true
|
|
}]]);"
|
|
`;
|
|
|
|
exports[`input[type="text"]: input[type="text"] 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelText as _vModelText } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"input\\", {
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test]]);"
|
|
`;
|
|
|
|
exports[`named import specifier \`Keep Alive\`: named import specifier \`Keep Alive\` 1`] = `
|
|
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
import { KeepAlive } from 'vue';
|
|
|
|
_createVNode(KeepAlive, null, [_createTextVNode(\\"123\\")]);"
|
|
`;
|
|
|
|
exports[`namespace specifier \`Keep Alive\`: namespace specifier \`Keep Alive\` 1`] = `
|
|
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
import * as Vue from 'vue';
|
|
|
|
_createVNode(Vue.KeepAlive, null, [_createTextVNode(\\"123\\")]);"
|
|
`;
|
|
|
|
exports[`override props multiple: multiple 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"A\\"), {
|
|
\\"loading\\": true,
|
|
...a,
|
|
b: 1,
|
|
c: {
|
|
d: 2
|
|
},
|
|
\\"class\\": \\"x\\",
|
|
\\"style\\": x
|
|
}, null);"
|
|
`;
|
|
|
|
exports[`override props single: single 1`] = `
|
|
"import { createVNode as _createVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"div\\", a, null);"
|
|
`;
|
|
|
|
exports[`passing object slots via JSX children multiple expressions: multiple expressions 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"A\\"), null, {
|
|
default: () => [foo, bar],
|
|
_: 1
|
|
});"
|
|
`;
|
|
|
|
exports[`passing object slots via JSX children single expression, function expression: single expression, function expression 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"A\\"), null, {
|
|
default: () => \\"foo\\"
|
|
});"
|
|
`;
|
|
|
|
exports[`passing object slots via JSX children single expression, non-literal value: runtime check: single expression, non-literal value: runtime check 1`] = `
|
|
"let _slot;
|
|
|
|
import { createVNode as _createVNode, isVNode as _isVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
function _isSlot(s) {
|
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
|
|
}
|
|
|
|
const foo = () => 1;
|
|
|
|
_createVNode(_resolveComponent(\\"A\\"), null, _isSlot(_slot = foo()) ? _slot : {
|
|
default: () => [_slot],
|
|
_: 1
|
|
});"
|
|
`;
|
|
|
|
exports[`reassign variable as component: reassign variable as component 1`] = `
|
|
"import { isVNode as _isVNode, createVNode as _createVNode } from \\"vue\\";
|
|
import { defineComponent } from 'vue';
|
|
|
|
function _isSlot(s) {
|
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
|
|
}
|
|
|
|
let a = 1;
|
|
const A = defineComponent({
|
|
setup(_, {
|
|
slots
|
|
}) {
|
|
return () => _createVNode(\\"span\\", null, [slots.default()]);
|
|
}
|
|
|
|
});
|
|
const _a2 = 2;
|
|
a = _a2;
|
|
|
|
const _a = function () {
|
|
return a;
|
|
}();
|
|
|
|
a = _createVNode(A, null, _isSlot(a) ? a : {
|
|
default: () => [_a],
|
|
_: 2
|
|
});"
|
|
`;
|
|
|
|
exports[`select: select 1`] = `
|
|
"import { withDirectives as _withDirectives, vModelSelect as _vModelSelect, createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"select\\", {
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, [_createVNode(\\"option\\", {
|
|
\\"value\\": \\"1\\"
|
|
}, [_createTextVNode(\\"a\\")]), _createVNode(\\"option\\", {
|
|
\\"value\\": 2
|
|
}, [_createTextVNode(\\"b\\")]), _createVNode(\\"option\\", {
|
|
\\"value\\": 3
|
|
}, [_createTextVNode(\\"c\\")])], 8, [\\"onUpdate:modelValue\\"]), [[_vModelSelect, test]]);"
|
|
`;
|
|
|
|
exports[`should keep \`import * as Vue from "vue"\`: should keep \`import * as Vue from "vue"\` 1`] = `
|
|
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
import * as Vue from 'vue';
|
|
|
|
_createVNode(\\"div\\", null, [_createTextVNode(\\"Vue\\")]);"
|
|
`;
|
|
|
|
exports[`single no need for a mergeProps call: single no need for a mergeProps call 1`] = `
|
|
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"div\\", x, [_createTextVNode(\\"single\\")], 16);"
|
|
`;
|
|
|
|
exports[`specifiers should be merged into a single importDeclaration: specifiers should be merged into a single importDeclaration 1`] = `
|
|
"import { createVNode as _createVNode } from \\"vue\\";
|
|
import { createVNode, Fragment as _Fragment } from 'vue';
|
|
import { vShow } from 'vue';
|
|
|
|
_createVNode(_Fragment, null, null);"
|
|
`;
|
|
|
|
exports[`textarea: textarea 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vModelText as _vModelText } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"textarea\\", {
|
|
\\"onUpdate:modelValue\\": $event => test = $event
|
|
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test]]);"
|
|
`;
|
|
|
|
exports[`use "model" as the prop name: use "model" as the prop name 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"C\\"), {
|
|
\\"model\\": foo,
|
|
\\"onUpdate:model\\": $event => foo = $event
|
|
}, null, 8, [\\"model\\", \\"onUpdate:model\\"]);"
|
|
`;
|
|
|
|
exports[`v-show: v-show 1`] = `
|
|
"import { withDirectives as _withDirectives, createVNode as _createVNode, vShow as _vShow, createTextVNode as _createTextVNode } from \\"vue\\";
|
|
|
|
_withDirectives(_createVNode(\\"div\\", null, [_createTextVNode(\\"vShow\\")], 512), [[_vShow, x]]);"
|
|
`;
|
|
|
|
exports[`vHtml: vHtml 1`] = `
|
|
"import { createVNode as _createVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"h1\\", {
|
|
\\"innerHTML\\": \\"<div>foo</div>\\"
|
|
}, null, 8, [\\"innerHTML\\"]);"
|
|
`;
|
|
|
|
exports[`vModels: vModels 1`] = `
|
|
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
|
|
|
_createVNode(_resolveComponent(\\"C\\"), {
|
|
\\"modelValue\\": foo,
|
|
\\"modelModifiers\\": {
|
|
\\"modifier\\": true
|
|
},
|
|
\\"onUpdate:modelValue\\": $event => foo = $event,
|
|
\\"bar\\": bar,
|
|
\\"barModifiers\\": {
|
|
\\"modifier1\\": true,
|
|
\\"modifier2\\": true
|
|
},
|
|
\\"onUpdate:bar\\": $event => bar = $event
|
|
}, null, 8, [\\"modelValue\\", \\"onUpdate:modelValue\\", \\"bar\\", \\"onUpdate:bar\\"]);"
|
|
`;
|
|
|
|
exports[`vText: vText 1`] = `
|
|
"import { createVNode as _createVNode } from \\"vue\\";
|
|
|
|
_createVNode(\\"div\\", {
|
|
\\"textContent\\": text
|
|
}, null, 8, [\\"textContent\\"]);"
|
|
`;
|