forked from vuejs/core
/
compileScriptRefTransform.spec.ts.snap
113 lines (84 loc) 路 1.95 KB
/
compileScriptRefTransform.spec.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`sfc ref transform $ unwrapping 1`] = `
"import { ref, shallowRef } from 'vue'
export default {
setup(__props, { expose }) {
expose();
let foo = ref()
let a = ref(1)
let b = shallowRef({
count: 0
})
let c = () => {}
let d
return { foo, a, b, c, d, ref, shallowRef }
}
}"
`;
exports[`sfc ref transform $ref & $shallowRef declarations 1`] = `
"import { ref as _ref, shallowRef as _shallowRef } from 'vue'
export default {
setup(__props, { expose }) {
expose();
let foo = _ref()
let a = _ref(1)
let b = _shallowRef({
count: 0
})
let c = () => {}
let d
return { foo, a, b, c, d }
}
}"
`;
exports[`sfc ref transform usage /w typescript 1`] = `
"import { ref as _ref, defineComponent as _defineComponent } from 'vue'
export default /*#__PURE__*/_defineComponent({
setup(__props, { expose }) {
expose();
let msg = _ref<string | number>('foo');
let bar = _ref <string | number>('bar');
return { msg, bar }
}
})"
`;
exports[`sfc ref transform usage in normal <script> 1`] = `
"import { ref as _ref } from 'vue'
export default {
setup() {
let count = _ref(0)
const inc = () => count.value++
return { count }
}
}
"
`;
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()
export default {
setup(__props, { expose }) {
expose();
console.log(data.value)
return { data }
}
}"
`;
exports[`sfc ref transform usage with normal <script> + <script setup> 1`] = `
"import { ref as _ref } from 'vue'
let a = _ref(0)
let c = _ref(0)
export default {
setup(__props, { expose }) {
expose();
let b = _ref(0)
let c = 0
function change() {
a.value++
b.value++
c++
}
return { a, c, b, change }
}
}"
`;