From cc47ae0118d269e1710c71eba4c0795c34958b1e Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 27 Jan 2020 14:42:01 -0500 Subject: [PATCH] test: update snapshots for toDisplayString --- .../__snapshots__/codegen.spec.ts.snap | 4 +-- .../__snapshots__/compile.spec.ts.snap | 18 +++++----- .../__snapshots__/scopeId.spec.ts.snap | 4 +-- .../__snapshots__/hoistStatic.spec.ts.snap | 30 ++++++++-------- .../__snapshots__/transformText.spec.ts.snap | 20 +++++------ .../__snapshots__/vSlot.spec.ts.snap | 34 +++++++++---------- .../compileTemplate.spec.ts.snap | 2 +- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap index 785d3be37..6b09fa2f7 100644 --- a/packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap +++ b/packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap @@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = ` " return function render() { with (this) { - return _ctx.foo + _toString(bar) + return _ctx.foo + _toDisplayString(bar) } }" `; @@ -159,7 +159,7 @@ exports[`compiler: codegen interpolation 1`] = ` " return function render() { with (this) { - return _toString(hello) + return _toDisplayString(hello) } }" `; diff --git a/packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap index 55bb9f921..a5b0cc9b0 100644 --- a/packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap +++ b/packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap @@ -5,19 +5,19 @@ exports[`compiler: integration tests function mode 1`] = ` return function render() { with (this) { - const { toString: _toString, openBlock: _openBlock, createVNode: _createVNode, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue + const { toDisplayString: _toDisplayString, openBlock: _openBlock, createVNode: _createVNode, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue return (_openBlock(), _createBlock(\\"div\\", { id: \\"foo\\", class: bar.baz }, [ - _createTextVNode(_toString(world.burn()) + \\" \\", 1 /* TEXT */), + _createTextVNode(_toDisplayString(world.burn()) + \\" \\", 1 /* TEXT */), (_openBlock(), ok ? _createBlock(\\"div\\", { key: 0 }, \\"yes\\") : _createBlock(_Fragment, { key: 1 }, [\\"no\\"])), (_openBlock(false), _createBlock(_Fragment, null, _renderList(list, (value, index) => { return (_openBlock(), _createBlock(\\"div\\", null, [ - _createVNode(\\"span\\", null, _toString(value + index), 1 /* TEXT */) + _createVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */) ])) }), 256 /* UNKEYED_FRAGMENT */)) ], 2 /* CLASS */)) @@ -26,7 +26,7 @@ return function render() { `; exports[`compiler: integration tests function mode w/ prefixIdentifiers: true 1`] = ` -"const { toString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } = Vue +"const { toDisplayString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } = Vue return function render() { const _ctx = this @@ -34,13 +34,13 @@ return function render() { id: \\"foo\\", class: _ctx.bar.baz }, [ - createTextVNode(toString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */), + createTextVNode(toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */), (openBlock(), (_ctx.ok) ? createBlock(\\"div\\", { key: 0 }, \\"yes\\") : createBlock(Fragment, { key: 1 }, [\\"no\\"])), (openBlock(false), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => { return (openBlock(), createBlock(\\"div\\", null, [ - createVNode(\\"span\\", null, toString(value + index), 1 /* TEXT */) + createVNode(\\"span\\", null, toDisplayString(value + index), 1 /* TEXT */) ])) }), 256 /* UNKEYED_FRAGMENT */)) ], 2 /* CLASS */)) @@ -48,7 +48,7 @@ return function render() { `; exports[`compiler: integration tests module mode 1`] = ` -"import { toString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } from \\"vue\\" +"import { toDisplayString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } from \\"vue\\" export function render() { const _ctx = this @@ -56,13 +56,13 @@ export function render() { id: \\"foo\\", class: _ctx.bar.baz }, [ - createTextVNode(toString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */), + createTextVNode(toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */), (openBlock(), (_ctx.ok) ? createBlock(\\"div\\", { key: 0 }, \\"yes\\") : createBlock(Fragment, { key: 1 }, [\\"no\\"])), (openBlock(false), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => { return (openBlock(), createBlock(\\"div\\", null, [ - createVNode(\\"span\\", null, toString(value + index), 1 /* TEXT */) + createVNode(\\"span\\", null, toDisplayString(value + index), 1 /* TEXT */) ])) }), 256 /* UNKEYED_FRAGMENT */)) ], 2 /* CLASS */)) diff --git a/packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap index d0fd955ca..e08bf6852 100644 --- a/packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap +++ b/packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap @@ -65,7 +65,7 @@ export const render = withId(function render() { `; exports[`scopeId compiler support should wrap named slots 1`] = ` -"import { toString, createTextVNode, createVNode, resolveComponent, createBlock, openBlock, withScopeId } from \\"vue\\" +"import { toDisplayString, createTextVNode, createVNode, resolveComponent, createBlock, openBlock, withScopeId } from \\"vue\\" const withId = withScopeId(\\"test\\") export const render = withId(function render() { @@ -74,7 +74,7 @@ export const render = withId(function render() { return (openBlock(), createBlock(_component_Child, null, { foo: withId(({ msg }) => [ - createTextVNode(toString(msg), 1 /* TEXT */) + createTextVNode(toDisplayString(msg), 1 /* TEXT */) ]), bar: withId(() => [ createVNode(\\"div\\") diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap index bce5d8ed7..32ceceaa1 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap @@ -121,10 +121,10 @@ const _hoisted_1 = { id: \\"foo\\" } return function render() { with (this) { - const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue + const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ - _createVNode(\\"div\\", _hoisted_1, _toString(hello), 1 /* TEXT */) + _createVNode(\\"div\\", _hoisted_1, _toDisplayString(hello), 1 /* TEXT */) ])) } }" @@ -159,10 +159,10 @@ const _hoisted_1 = { class: { foo: true } } return function render() { with (this) { - const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue + const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ - _createVNode(\\"span\\", _hoisted_1, _toString(_ctx.bar), 1 /* TEXT */) + _createVNode(\\"span\\", _hoisted_1, _toDisplayString(_ctx.bar), 1 /* TEXT */) ])) } }" @@ -174,14 +174,14 @@ const { createVNode: _createVNode } = Vue const _hoisted_1 = _createVNode(\\"span\\", null, [ \\"foo \\", - _toString(1), + _toDisplayString(1), \\" \\", - _toString(true) + _toDisplayString(true) ]) return function render() { with (this) { - const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue + const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ _hoisted_1 @@ -194,11 +194,11 @@ exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static t "const _Vue = Vue const { createVNode: _createVNode } = Vue -const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toString(1)) +const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1)) return function render() { with (this) { - const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue + const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ _hoisted_1 @@ -228,12 +228,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr return function render() { with (this) { - const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toString: _toString, createVNode: _createVNode } = _Vue + const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ (_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => { return (_openBlock(), _createBlock(\\"p\\", null, [ - _createVNode(\\"span\\", null, _toString(o + 'foo'), 1 /* TEXT */) + _createVNode(\\"span\\", null, _toDisplayString(o + 'foo'), 1 /* TEXT */) ])) }), 256 /* UNKEYED_FRAGMENT */)) ])) @@ -246,12 +246,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr return function render() { with (this) { - const { toString: _toString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue + const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue const _component_Comp = _resolveComponent(\\"Comp\\") return (_openBlock(), _createBlock(_component_Comp, null, { - default: ({ foo }) => [_toString(_ctx.foo)], + default: ({ foo }) => [_toDisplayString(_ctx.foo)], _compiled: true })) } @@ -263,12 +263,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr return function render() { with (this) { - const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toString: _toString, createVNode: _createVNode } = _Vue + const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue return (_openBlock(), _createBlock(\\"div\\", null, [ (_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => { return (_openBlock(), _createBlock(\\"p\\", null, [ - _createVNode(\\"span\\", null, _toString(o), 1 /* TEXT */) + _createVNode(\\"span\\", null, _toDisplayString(o), 1 /* TEXT */) ])) }), 256 /* UNKEYED_FRAGMENT */)) ])) diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap index edfe8dc3e..1576decfb 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap @@ -21,9 +21,9 @@ exports[`compiler: transform text consecutive text 1`] = ` return function render() { with (this) { - const { toString: _toString } = _Vue + const { toDisplayString: _toDisplayString } = _Vue - return _toString(foo) + \\" bar \\" + _toString(baz) + return _toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz) } }" `; @@ -33,11 +33,11 @@ exports[`compiler: transform text consecutive text between elements 1`] = ` return function render() { with (this) { - const { createVNode: _createVNode, toString: _toString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue + const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(_Fragment, null, [ _createVNode(\\"div\\"), - _createTextVNode(_toString(foo) + \\" bar \\" + _toString(baz), 1 /* TEXT */), + _createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */), _createVNode(\\"div\\") ], 64 /* STABLE_FRAGMENT */)) } @@ -49,11 +49,11 @@ exports[`compiler: transform text consecutive text mixed with elements 1`] = ` return function render() { with (this) { - const { createVNode: _createVNode, toString: _toString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue + const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue return (_openBlock(), _createBlock(_Fragment, null, [ _createVNode(\\"div\\"), - _createTextVNode(_toString(foo) + \\" bar \\" + _toString(baz), 1 /* TEXT */), + _createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */), _createVNode(\\"div\\"), _createTextVNode(\\"hello\\"), _createVNode(\\"div\\") @@ -67,9 +67,9 @@ exports[`compiler: transform text no consecutive text 1`] = ` return function render() { with (this) { - const { toString: _toString } = _Vue + const { toDisplayString: _toDisplayString } = _Vue - return _toString(foo) + return _toDisplayString(foo) } }" `; @@ -91,10 +91,10 @@ return function render() { `; exports[`compiler: transform text with prefixIdentifiers: true 1`] = ` -"const { toString } = Vue +"const { toDisplayString } = Vue return function render() { const _ctx = this - return toString(_ctx.foo) + \\" bar \\" + toString(_ctx.baz + _ctx.qux) + return toDisplayString(_ctx.foo) + \\" bar \\" + toDisplayString(_ctx.baz + _ctx.qux) }" `; diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap index e7f44eec7..ef980e09d 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`compiler: transform component slots dynamically named slots 1`] = ` -"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this const _component_Comp = resolveComponent(\\"Comp\\") return (openBlock(), createBlock(_component_Comp, null, { - [_ctx.one]: ({ foo }) => [toString(foo), toString(_ctx.bar)], - [_ctx.two]: ({ bar }) => [toString(_ctx.foo), toString(bar)], + [_ctx.one]: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)], + [_ctx.two]: ({ bar }) => [toDisplayString(_ctx.foo), toDisplayString(bar)], _compiled: true }, 512 /* DYNAMIC_SLOTS */)) }" @@ -32,7 +32,7 @@ return function render() { `; exports[`compiler: transform component slots named slot with v-for w/ prefixIdentifiers: true 1`] = ` -"const { toString, resolveComponent, renderList, createSlots, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, renderList, createSlots, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this @@ -42,7 +42,7 @@ return function render() { renderList(_ctx.list, (name) => { return { name: name, - fn: () => [toString(name)] + fn: () => [toDisplayString(name)] } }) ]), 512 /* DYNAMIC_SLOTS */)) @@ -50,7 +50,7 @@ return function render() { `; exports[`compiler: transform component slots named slot with v-if + prefixIdentifiers: true 1`] = ` -"const { toString, resolveComponent, createSlots, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, createSlots, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this @@ -60,7 +60,7 @@ return function render() { (_ctx.ok) ? { name: \\"one\\", - fn: (props) => [toString(props)] + fn: (props) => [toDisplayString(props)] } : undefined ]), 512 /* DYNAMIC_SLOTS */)) @@ -118,15 +118,15 @@ return function render() { `; exports[`compiler: transform component slots named slots 1`] = ` -"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this const _component_Comp = resolveComponent(\\"Comp\\") return (openBlock(), createBlock(_component_Comp, null, { - one: ({ foo }) => [toString(foo), toString(_ctx.bar)], - two: ({ bar }) => [toString(_ctx.foo), toString(bar)], + one: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)], + two: ({ bar }) => [toDisplayString(_ctx.foo), toDisplayString(bar)], _compiled: true })) }" @@ -154,7 +154,7 @@ return function render() { `; exports[`compiler: transform component slots nested slots scoping 1`] = ` -"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this @@ -164,13 +164,13 @@ return function render() { return (openBlock(), createBlock(_component_Comp, null, { default: ({ foo }) => [ createVNode(_component_Inner, null, { - default: ({ bar }) => [toString(foo), toString(bar), toString(_ctx.baz)], + default: ({ bar }) => [toDisplayString(foo), toDisplayString(bar), toDisplayString(_ctx.baz)], _compiled: true }, 512 /* DYNAMIC_SLOTS */), \\" \\", - toString(foo), - toString(_ctx.bar), - toString(_ctx.baz) + toDisplayString(foo), + toDisplayString(_ctx.bar), + toDisplayString(_ctx.baz) ], _compiled: true })) @@ -178,14 +178,14 @@ return function render() { `; exports[`compiler: transform component slots on-component default slot 1`] = ` -"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue +"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue return function render() { const _ctx = this const _component_Comp = resolveComponent(\\"Comp\\") return (openBlock(), createBlock(_component_Comp, null, { - default: ({ foo }) => [toString(foo), toString(_ctx.bar)], + default: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)], _compiled: true })) }" diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileTemplate.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileTemplate.spec.ts.snap index b20246438..aba3255df 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileTemplate.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileTemplate.spec.ts.snap @@ -2,7 +2,7 @@ exports[`source map 1`] = ` Object { - "mappings": ";;;;UAAA,aACE,YAA8B;IAAzB,YAAmB,oBAAbA,WAAM", + "mappings": ";;;;UAAA,aACE,YAA8B;IAAzB,YAAmB,2BAAbA,WAAM", "names": Array [ "render", ],