Skip to content

Commit cc47ae0

Browse files
committed
test: update snapshots for toDisplayString
1 parent 2884831 commit cc47ae0

File tree

7 files changed

+56
-56
lines changed

7 files changed

+56
-56
lines changed

packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = `
9999
"
100100
return function render() {
101101
with (this) {
102-
return _ctx.foo + _toString(bar)
102+
return _ctx.foo + _toDisplayString(bar)
103103
}
104104
}"
105105
`;
@@ -159,7 +159,7 @@ exports[`compiler: codegen interpolation 1`] = `
159159
"
160160
return function render() {
161161
with (this) {
162-
return _toString(hello)
162+
return _toDisplayString(hello)
163163
}
164164
}"
165165
`;

packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ exports[`compiler: integration tests function mode 1`] = `
55
66
return function render() {
77
with (this) {
8-
const { toString: _toString, openBlock: _openBlock, createVNode: _createVNode, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
8+
const { toDisplayString: _toDisplayString, openBlock: _openBlock, createVNode: _createVNode, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
99
1010
return (_openBlock(), _createBlock(\\"div\\", {
1111
id: \\"foo\\",
1212
class: bar.baz
1313
}, [
14-
_createTextVNode(_toString(world.burn()) + \\" \\", 1 /* TEXT */),
14+
_createTextVNode(_toDisplayString(world.burn()) + \\" \\", 1 /* TEXT */),
1515
(_openBlock(), ok
1616
? _createBlock(\\"div\\", { key: 0 }, \\"yes\\")
1717
: _createBlock(_Fragment, { key: 1 }, [\\"no\\"])),
1818
(_openBlock(false), _createBlock(_Fragment, null, _renderList(list, (value, index) => {
1919
return (_openBlock(), _createBlock(\\"div\\", null, [
20-
_createVNode(\\"span\\", null, _toString(value + index), 1 /* TEXT */)
20+
_createVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
2121
]))
2222
}), 256 /* UNKEYED_FRAGMENT */))
2323
], 2 /* CLASS */))
@@ -26,43 +26,43 @@ return function render() {
2626
`;
2727

2828
exports[`compiler: integration tests function mode w/ prefixIdentifiers: true 1`] = `
29-
"const { toString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } = Vue
29+
"const { toDisplayString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } = Vue
3030
3131
return function render() {
3232
const _ctx = this
3333
return (openBlock(), createBlock(\\"div\\", {
3434
id: \\"foo\\",
3535
class: _ctx.bar.baz
3636
}, [
37-
createTextVNode(toString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
37+
createTextVNode(toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
3838
(openBlock(), (_ctx.ok)
3939
? createBlock(\\"div\\", { key: 0 }, \\"yes\\")
4040
: createBlock(Fragment, { key: 1 }, [\\"no\\"])),
4141
(openBlock(false), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => {
4242
return (openBlock(), createBlock(\\"div\\", null, [
43-
createVNode(\\"span\\", null, toString(value + index), 1 /* TEXT */)
43+
createVNode(\\"span\\", null, toDisplayString(value + index), 1 /* TEXT */)
4444
]))
4545
}), 256 /* UNKEYED_FRAGMENT */))
4646
], 2 /* CLASS */))
4747
}"
4848
`;
4949

5050
exports[`compiler: integration tests module mode 1`] = `
51-
"import { toString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } from \\"vue\\"
51+
"import { toDisplayString, openBlock, createVNode, createBlock, createCommentVNode, Fragment, renderList, createTextVNode } from \\"vue\\"
5252
5353
export function render() {
5454
const _ctx = this
5555
return (openBlock(), createBlock(\\"div\\", {
5656
id: \\"foo\\",
5757
class: _ctx.bar.baz
5858
}, [
59-
createTextVNode(toString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
59+
createTextVNode(toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
6060
(openBlock(), (_ctx.ok)
6161
? createBlock(\\"div\\", { key: 0 }, \\"yes\\")
6262
: createBlock(Fragment, { key: 1 }, [\\"no\\"])),
6363
(openBlock(false), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => {
6464
return (openBlock(), createBlock(\\"div\\", null, [
65-
createVNode(\\"span\\", null, toString(value + index), 1 /* TEXT */)
65+
createVNode(\\"span\\", null, toDisplayString(value + index), 1 /* TEXT */)
6666
]))
6767
}), 256 /* UNKEYED_FRAGMENT */))
6868
], 2 /* CLASS */))

packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const render = withId(function render() {
6565
`;
6666

6767
exports[`scopeId compiler support should wrap named slots 1`] = `
68-
"import { toString, createTextVNode, createVNode, resolveComponent, createBlock, openBlock, withScopeId } from \\"vue\\"
68+
"import { toDisplayString, createTextVNode, createVNode, resolveComponent, createBlock, openBlock, withScopeId } from \\"vue\\"
6969
const withId = withScopeId(\\"test\\")
7070
7171
export const render = withId(function render() {
@@ -74,7 +74,7 @@ export const render = withId(function render() {
7474
7575
return (openBlock(), createBlock(_component_Child, null, {
7676
foo: withId(({ msg }) => [
77-
createTextVNode(toString(msg), 1 /* TEXT */)
77+
createTextVNode(toDisplayString(msg), 1 /* TEXT */)
7878
]),
7979
bar: withId(() => [
8080
createVNode(\\"div\\")

packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap

+15-15
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ const _hoisted_1 = { id: \\"foo\\" }
121121
122122
return function render() {
123123
with (this) {
124-
const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
124+
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
125125
126126
return (_openBlock(), _createBlock(\\"div\\", null, [
127-
_createVNode(\\"div\\", _hoisted_1, _toString(hello), 1 /* TEXT */)
127+
_createVNode(\\"div\\", _hoisted_1, _toDisplayString(hello), 1 /* TEXT */)
128128
]))
129129
}
130130
}"
@@ -159,10 +159,10 @@ const _hoisted_1 = { class: { foo: true } }
159159
160160
return function render() {
161161
with (this) {
162-
const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
162+
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
163163
164164
return (_openBlock(), _createBlock(\\"div\\", null, [
165-
_createVNode(\\"span\\", _hoisted_1, _toString(_ctx.bar), 1 /* TEXT */)
165+
_createVNode(\\"span\\", _hoisted_1, _toDisplayString(_ctx.bar), 1 /* TEXT */)
166166
]))
167167
}
168168
}"
@@ -174,14 +174,14 @@ const { createVNode: _createVNode } = Vue
174174
175175
const _hoisted_1 = _createVNode(\\"span\\", null, [
176176
\\"foo \\",
177-
_toString(1),
177+
_toDisplayString(1),
178178
\\" \\",
179-
_toString(true)
179+
_toDisplayString(true)
180180
])
181181
182182
return function render() {
183183
with (this) {
184-
const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
184+
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
185185
186186
return (_openBlock(), _createBlock(\\"div\\", null, [
187187
_hoisted_1
@@ -194,11 +194,11 @@ exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static t
194194
"const _Vue = Vue
195195
const { createVNode: _createVNode } = Vue
196196
197-
const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toString(1))
197+
const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1))
198198
199199
return function render() {
200200
with (this) {
201-
const { toString: _toString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
201+
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
202202
203203
return (_openBlock(), _createBlock(\\"div\\", null, [
204204
_hoisted_1
@@ -228,12 +228,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
228228
229229
return function render() {
230230
with (this) {
231-
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toString: _toString, createVNode: _createVNode } = _Vue
231+
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
232232
233233
return (_openBlock(), _createBlock(\\"div\\", null, [
234234
(_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
235235
return (_openBlock(), _createBlock(\\"p\\", null, [
236-
_createVNode(\\"span\\", null, _toString(o + 'foo'), 1 /* TEXT */)
236+
_createVNode(\\"span\\", null, _toDisplayString(o + 'foo'), 1 /* TEXT */)
237237
]))
238238
}), 256 /* UNKEYED_FRAGMENT */))
239239
]))
@@ -246,12 +246,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
246246
247247
return function render() {
248248
with (this) {
249-
const { toString: _toString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
249+
const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
250250
251251
const _component_Comp = _resolveComponent(\\"Comp\\")
252252
253253
return (_openBlock(), _createBlock(_component_Comp, null, {
254-
default: ({ foo }) => [_toString(_ctx.foo)],
254+
default: ({ foo }) => [_toDisplayString(_ctx.foo)],
255255
_compiled: true
256256
}))
257257
}
@@ -263,12 +263,12 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
263263
264264
return function render() {
265265
with (this) {
266-
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toString: _toString, createVNode: _createVNode } = _Vue
266+
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
267267
268268
return (_openBlock(), _createBlock(\\"div\\", null, [
269269
(_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
270270
return (_openBlock(), _createBlock(\\"p\\", null, [
271-
_createVNode(\\"span\\", null, _toString(o), 1 /* TEXT */)
271+
_createVNode(\\"span\\", null, _toDisplayString(o), 1 /* TEXT */)
272272
]))
273273
}), 256 /* UNKEYED_FRAGMENT */))
274274
]))

packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ exports[`compiler: transform text consecutive text 1`] = `
2121
2222
return function render() {
2323
with (this) {
24-
const { toString: _toString } = _Vue
24+
const { toDisplayString: _toDisplayString } = _Vue
2525
26-
return _toString(foo) + \\" bar \\" + _toString(baz)
26+
return _toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz)
2727
}
2828
}"
2929
`;
@@ -33,11 +33,11 @@ exports[`compiler: transform text consecutive text between elements 1`] = `
3333
3434
return function render() {
3535
with (this) {
36-
const { createVNode: _createVNode, toString: _toString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
36+
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
3737
3838
return (_openBlock(), _createBlock(_Fragment, null, [
3939
_createVNode(\\"div\\"),
40-
_createTextVNode(_toString(foo) + \\" bar \\" + _toString(baz), 1 /* TEXT */),
40+
_createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
4141
_createVNode(\\"div\\")
4242
], 64 /* STABLE_FRAGMENT */))
4343
}
@@ -49,11 +49,11 @@ exports[`compiler: transform text consecutive text mixed with elements 1`] = `
4949
5050
return function render() {
5151
with (this) {
52-
const { createVNode: _createVNode, toString: _toString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
52+
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
5353
5454
return (_openBlock(), _createBlock(_Fragment, null, [
5555
_createVNode(\\"div\\"),
56-
_createTextVNode(_toString(foo) + \\" bar \\" + _toString(baz), 1 /* TEXT */),
56+
_createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
5757
_createVNode(\\"div\\"),
5858
_createTextVNode(\\"hello\\"),
5959
_createVNode(\\"div\\")
@@ -67,9 +67,9 @@ exports[`compiler: transform text no consecutive text 1`] = `
6767
6868
return function render() {
6969
with (this) {
70-
const { toString: _toString } = _Vue
70+
const { toDisplayString: _toDisplayString } = _Vue
7171
72-
return _toString(foo)
72+
return _toDisplayString(foo)
7373
}
7474
}"
7575
`;
@@ -91,10 +91,10 @@ return function render() {
9191
`;
9292
9393
exports[`compiler: transform text with prefixIdentifiers: true 1`] = `
94-
"const { toString } = Vue
94+
"const { toDisplayString } = Vue
9595
9696
return function render() {
9797
const _ctx = this
98-
return toString(_ctx.foo) + \\" bar \\" + toString(_ctx.baz + _ctx.qux)
98+
return toDisplayString(_ctx.foo) + \\" bar \\" + toDisplayString(_ctx.baz + _ctx.qux)
9999
}"
100100
`;

packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`compiler: transform component slots dynamically named slots 1`] = `
4-
"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue
4+
"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue
55
66
return function render() {
77
const _ctx = this
88
const _component_Comp = resolveComponent(\\"Comp\\")
99
1010
return (openBlock(), createBlock(_component_Comp, null, {
11-
[_ctx.one]: ({ foo }) => [toString(foo), toString(_ctx.bar)],
12-
[_ctx.two]: ({ bar }) => [toString(_ctx.foo), toString(bar)],
11+
[_ctx.one]: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)],
12+
[_ctx.two]: ({ bar }) => [toDisplayString(_ctx.foo), toDisplayString(bar)],
1313
_compiled: true
1414
}, 512 /* DYNAMIC_SLOTS */))
1515
}"
@@ -32,7 +32,7 @@ return function render() {
3232
`;
3333

3434
exports[`compiler: transform component slots named slot with v-for w/ prefixIdentifiers: true 1`] = `
35-
"const { toString, resolveComponent, renderList, createSlots, createVNode, createBlock, openBlock } = Vue
35+
"const { toDisplayString, resolveComponent, renderList, createSlots, createVNode, createBlock, openBlock } = Vue
3636
3737
return function render() {
3838
const _ctx = this
@@ -42,15 +42,15 @@ return function render() {
4242
renderList(_ctx.list, (name) => {
4343
return {
4444
name: name,
45-
fn: () => [toString(name)]
45+
fn: () => [toDisplayString(name)]
4646
}
4747
})
4848
]), 512 /* DYNAMIC_SLOTS */))
4949
}"
5050
`;
5151

5252
exports[`compiler: transform component slots named slot with v-if + prefixIdentifiers: true 1`] = `
53-
"const { toString, resolveComponent, createSlots, createVNode, createBlock, openBlock } = Vue
53+
"const { toDisplayString, resolveComponent, createSlots, createVNode, createBlock, openBlock } = Vue
5454
5555
return function render() {
5656
const _ctx = this
@@ -60,7 +60,7 @@ return function render() {
6060
(_ctx.ok)
6161
? {
6262
name: \\"one\\",
63-
fn: (props) => [toString(props)]
63+
fn: (props) => [toDisplayString(props)]
6464
}
6565
: undefined
6666
]), 512 /* DYNAMIC_SLOTS */))
@@ -118,15 +118,15 @@ return function render() {
118118
`;
119119

120120
exports[`compiler: transform component slots named slots 1`] = `
121-
"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue
121+
"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue
122122
123123
return function render() {
124124
const _ctx = this
125125
const _component_Comp = resolveComponent(\\"Comp\\")
126126
127127
return (openBlock(), createBlock(_component_Comp, null, {
128-
one: ({ foo }) => [toString(foo), toString(_ctx.bar)],
129-
two: ({ bar }) => [toString(_ctx.foo), toString(bar)],
128+
one: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)],
129+
two: ({ bar }) => [toDisplayString(_ctx.foo), toDisplayString(bar)],
130130
_compiled: true
131131
}))
132132
}"
@@ -154,7 +154,7 @@ return function render() {
154154
`;
155155

156156
exports[`compiler: transform component slots nested slots scoping 1`] = `
157-
"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue
157+
"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue
158158
159159
return function render() {
160160
const _ctx = this
@@ -164,28 +164,28 @@ return function render() {
164164
return (openBlock(), createBlock(_component_Comp, null, {
165165
default: ({ foo }) => [
166166
createVNode(_component_Inner, null, {
167-
default: ({ bar }) => [toString(foo), toString(bar), toString(_ctx.baz)],
167+
default: ({ bar }) => [toDisplayString(foo), toDisplayString(bar), toDisplayString(_ctx.baz)],
168168
_compiled: true
169169
}, 512 /* DYNAMIC_SLOTS */),
170170
\\" \\",
171-
toString(foo),
172-
toString(_ctx.bar),
173-
toString(_ctx.baz)
171+
toDisplayString(foo),
172+
toDisplayString(_ctx.bar),
173+
toDisplayString(_ctx.baz)
174174
],
175175
_compiled: true
176176
}))
177177
}"
178178
`;
179179

180180
exports[`compiler: transform component slots on-component default slot 1`] = `
181-
"const { toString, resolveComponent, createVNode, createBlock, openBlock } = Vue
181+
"const { toDisplayString, resolveComponent, createVNode, createBlock, openBlock } = Vue
182182
183183
return function render() {
184184
const _ctx = this
185185
const _component_Comp = resolveComponent(\\"Comp\\")
186186
187187
return (openBlock(), createBlock(_component_Comp, null, {
188-
default: ({ foo }) => [toString(foo), toString(_ctx.bar)],
188+
default: ({ foo }) => [toDisplayString(foo), toDisplayString(_ctx.bar)],
189189
_compiled: true
190190
}))
191191
}"

0 commit comments

Comments
 (0)