Skip to content

Commit 7a13fd6

Browse files
committed
add test case for extending injection
1 parent 01db8fe commit 7a13fd6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: test/unit/features/options/inject.spec.js

+29
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,35 @@ describe('Options provide/inject', () => {
220220
})
221221
})
222222

223+
it('should extend properly', () => {
224+
const parent = Vue.extend({
225+
template: `<span/>`,
226+
inject: ['foo']
227+
})
228+
229+
const child = parent.extend({
230+
template: `<span/>`,
231+
inject: ['bar'],
232+
created () {
233+
injected = [this.foo, this.bar]
234+
}
235+
})
236+
237+
new Vue({
238+
template: `<div><parent/><child/></div>`,
239+
provide: {
240+
foo: 1,
241+
bar: false
242+
},
243+
components: {
244+
parent,
245+
child
246+
}
247+
}).$mount()
248+
249+
expect(injected).toEqual([1, false])
250+
})
251+
223252
it('should warn when injections has been modified', () => {
224253
const key = 'foo'
225254
const vm = new Vue({

0 commit comments

Comments
 (0)