Skip to content

Commit

Permalink
wip(vitest-migration): compiler-sfc tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 26, 2023
1 parent 8599242 commit 0cd2213
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 356 deletions.
268 changes: 134 additions & 134 deletions packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`sfc props transform $$() escape 1`] = `
exports[`sfc props transform > $$() escape 1`] = `
"import { toRef as _toRef } from 'vue'
export default {
Expand All @@ -20,8 +20,8 @@ return () => {}
}"
`;

exports[`sfc props transform aliasing 1`] = `
"import { toDisplayString as _toDisplayString } from "vue"
exports[`sfc props transform > aliasing 1`] = `
"import { toDisplayString as _toDisplayString } from \\"vue\\"
export default {
Expand All @@ -40,8 +40,8 @@ return (_ctx, _cache) => {
}"
`;

exports[`sfc props transform basic usage 1`] = `
"import { toDisplayString as _toDisplayString } from "vue"
exports[`sfc props transform > basic usage 1`] = `
"import { toDisplayString as _toDisplayString } from \\"vue\\"
export default {
Expand All @@ -59,8 +59,8 @@ return (_ctx, _cache) => {
}"
`;

exports[`sfc props transform computed static key 1`] = `
"import { toDisplayString as _toDisplayString } from "vue"
exports[`sfc props transform > computed static key 1`] = `
"import { toDisplayString as _toDisplayString } from \\"vue\\"
export default {
Expand All @@ -78,7 +78,7 @@ return (_ctx, _cache) => {
}"
`;

exports[`sfc props transform default values w/ runtime declaration 1`] = `
exports[`sfc props transform > default values w/ runtime declaration 1`] = `
"import { mergeDefaults as _mergeDefaults } from 'vue'
export default {
Expand All @@ -96,7 +96,7 @@ return () => {}
}"
`;

exports[`sfc props transform default values w/ type declaration 1`] = `
exports[`sfc props transform > default values w/ type declaration 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
export default /*#__PURE__*/_defineComponent({
Expand All @@ -114,7 +114,7 @@ return () => {}
})"
`;

exports[`sfc props transform default values w/ type declaration, prod mode 1`] = `
exports[`sfc props transform > default values w/ type declaration, prod mode 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
export default /*#__PURE__*/_defineComponent({
Expand All @@ -136,8 +136,8 @@ return () => {}
})"
`;

exports[`sfc props transform multiple variable declarations 1`] = `
"import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
exports[`sfc props transform > multiple variable declarations 1`] = `
"import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export default {
Expand All @@ -147,14 +147,14 @@ export default {
const bar = 'fish', hello = 'world'
return (_ctx, _cache) => {
return (_openBlock(), _createElementBlock("div", null, _toDisplayString(__props.foo) + " " + _toDisplayString(hello) + " " + _toDisplayString(bar), 1 /* TEXT */))
return (_openBlock(), _createElementBlock(\\"div\\", null, _toDisplayString(__props.foo) + \\" \\" + _toDisplayString(hello) + \\" \\" + _toDisplayString(bar), 1 /* TEXT */))
}
}
}"
`;

exports[`sfc props transform nested scope 1`] = `
exports[`sfc props transform > nested scope 1`] = `
"export default {
props: ['foo', 'bar'],
setup(__props) {
Expand All @@ -171,33 +171,33 @@ return () => {}
}"
`;

exports[`sfc props transform non-identifier prop names 1`] = `
"import { toDisplayString as _toDisplayString } from "vue"
exports[`sfc props transform > non-identifier prop names 1`] = `
"import { toDisplayString as _toDisplayString } from \\"vue\\"
export default {
props: { 'foo.bar': Function },
setup(__props) {
let x = __props["foo.bar"]
let x = __props[\\"foo.bar\\"]
return (_ctx, _cache) => {
return _toDisplayString(__props["foo.bar"])
return _toDisplayString(__props[\\"foo.bar\\"])
}
}
}"
`;

exports[`sfc props transform rest spread 1`] = `
exports[`sfc props transform > rest spread 1`] = `
"import { createPropsRestProxy as _createPropsRestProxy } from 'vue'
export default {
props: ['foo', 'bar', 'baz'],
setup(__props) {
const rest = _createPropsRestProxy(__props, ["foo","bar"]);
const rest = _createPropsRestProxy(__props, [\\"foo\\",\\"bar\\"]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`sfc ref transform $ unwrapping 1`] = `
exports[`sfc ref transform > $ unwrapping 1`] = `
"import { ref, shallowRef } from 'vue'
export default {
Expand All @@ -21,7 +21,7 @@ return { foo, a, b, get c() { return c }, set c(v) { c = v }, get d() { return d
}"
`;

exports[`sfc ref transform $ref & $shallowRef declarations 1`] = `
exports[`sfc ref transform > $ref & $shallowRef declarations 1`] = `
"import { ref as _ref, shallowRef as _shallowRef } from 'vue'
export default {
Expand All @@ -42,7 +42,7 @@ return { foo, a, b, get c() { return c }, set c(v) { c = v }, get d() { return d
}"
`;

exports[`sfc ref transform usage /w typescript 1`] = `
exports[`sfc ref transform > usage /w typescript 1`] = `
"import { ref as _ref, defineComponent as _defineComponent } from 'vue'
export default /*#__PURE__*/_defineComponent({
Expand All @@ -58,7 +58,7 @@ return { msg, bar }
})"
`;

exports[`sfc ref transform usage in normal <script> 1`] = `
exports[`sfc ref transform > usage in normal <script> 1`] = `
"import { ref as _ref } from 'vue'
export default {
Expand All @@ -71,7 +71,7 @@ exports[`sfc ref transform usage in normal <script> 1`] = `
"
`;
exports[`sfc ref transform usage with normal <script> (has macro usage) + <script setup> (no macro usage) 1`] = `
exports[`sfc ref transform > usage with normal <script> (has macro usage) + <script setup> (no macro usage) 1`] = `
"import { ref as _ref } from 'vue'
let data = _ref()
Expand All @@ -88,7 +88,7 @@ return { data }
}"
`;
exports[`sfc ref transform usage with normal <script> + <script setup> 1`] = `
exports[`sfc ref transform > usage with normal <script> + <script setup> 1`] = `
"import { ref as _ref } from 'vue'
let a = _ref(0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`dynamic v-on + static v-on should merged 1`] = `
"import { toHandlerKey as _toHandlerKey, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
"import { toHandlerKey as _toHandlerKey, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("input", _mergeProps({
return (_openBlock(), _createElementBlock(\\"input\\", _mergeProps({
onBlur: _cache[0] || (_cache[0] = (...args) => (_ctx.onBlur && _ctx.onBlur(...args)))
}, {
[_toHandlerKey(_ctx.validateEvent)]: _cache[1] || (_cache[1] = (...args) => (_ctx.onValidateEvent && _ctx.onValidateEvent(...args)))
Expand All @@ -13,41 +13,41 @@ export function render(_ctx, _cache) {
`;

exports[`should not hoist srcset URLs in SSR mode 1`] = `
"import { resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode } from "vue"
import { ssrRenderAttr as _ssrRenderAttr, ssrRenderComponent as _ssrRenderComponent } from "vue/server-renderer"
"import { resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode } from \\"vue\\"
import { ssrRenderAttr as _ssrRenderAttr, ssrRenderComponent as _ssrRenderComponent } from \\"vue/server-renderer\\"
import _imports_0 from './img/foo.svg'
import _imports_1 from './img/bar.svg'
export function ssrRender(_ctx, _push, _parent, _attrs) {
const _component_router_link = _resolveComponent("router-link")
const _component_router_link = _resolveComponent(\\"router-link\\")
_push(\`<!--[--><picture><source\${
_ssrRenderAttr("srcset", _imports_0)
_ssrRenderAttr(\\"srcset\\", _imports_0)
}><img\${
_ssrRenderAttr("src", _imports_0)
_ssrRenderAttr(\\"src\\", _imports_0)
}></picture>\`)
_push(_ssrRenderComponent(_component_router_link, null, {
default: _withCtx((_, _push, _parent, _scopeId) => {
if (_push) {
_push(\`<picture\${
_scopeId
}><source\${
_ssrRenderAttr("srcset", _imports_1)
_ssrRenderAttr(\\"srcset\\", _imports_1)
}\${
_scopeId
}><img\${
_ssrRenderAttr("src", _imports_1)
_ssrRenderAttr(\\"src\\", _imports_1)
}\${
_scopeId
}></picture>\`)
} else {
return [
_createVNode("picture", null, [
_createVNode("source", {
_createVNode(\\"picture\\", null, [
_createVNode(\\"source\\", {
srcset: _imports_1
}),
_createVNode("img", { src: _imports_1 })
_createVNode(\\"img\\", { src: _imports_1 })
])
]
}
Expand Down
Loading

0 comments on commit 0cd2213

Please sign in to comment.