+27
-3
lines changedFilter options
+27
-3
lines changed Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ export function deepMergeData(
19
19
to[key] = fromVal
20
20
}
21
21
}
22
+
return to
22
23
}
23
24
24
25
export function mergeDataOption(to: any, from: any) {
Original file line number Diff line number Diff line change
@@ -47,19 +47,42 @@ test('data deep merge', () => {
47
47
data: () => ({
48
48
foo: {
49
49
bar: 1
50
-
}
50
+
},
51
+
selfData: 3
51
52
}),
52
-
template: `{{ foo }}`
53
+
template: `{{ { selfData, foo } }}`
53
54
}).$mount()
54
55
55
-
expect(vm.$el.textContent).toBe(JSON.stringify({ baz: 2, bar: 1 }, null, 2))
56
+
expect(vm.$el.textContent).toBe(
57
+
JSON.stringify({ selfData: 3, foo: { baz: 2, bar: 1 } }, null, 2)
58
+
)
56
59
expect(
57
60
(deprecationData[DeprecationTypes.OPTIONS_DATA_MERGE].message as Function)(
58
61
'foo'
59
62
)
60
63
).toHaveBeenWarned()
61
64
})
62
65
66
+
// #3852
67
+
test('data deep merge w/ extended constructor', () => {
68
+
const App = Vue.extend({
69
+
template: `<pre>{{ { mixinData, selfData } }}</pre>`,
70
+
mixins: [{ data: () => ({ mixinData: 'mixinData' }) }],
71
+
data: () => ({ selfData: 'selfData' })
72
+
})
73
+
const vm = new App().$mount()
74
+
expect(vm.$el.textContent).toBe(
75
+
JSON.stringify(
76
+
{
77
+
mixinData: 'mixinData',
78
+
selfData: 'selfData'
79
+
},
80
+
null,
81
+
2
82
+
)
83
+
)
84
+
})
85
+
63
86
test('beforeDestroy/destroyed', async () => {
64
87
const beforeDestroy = jest.fn()
65
88
const destroyed = jest.fn()
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4