File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
test/unit/features/options Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -298,4 +298,44 @@ describe('Options provide/inject', () => {
298
298
expect ( `Injection "bar" not found` ) . not . toHaveBeenWarned ( )
299
299
expect ( `Injection "baz" not found` ) . not . toHaveBeenWarned ( )
300
300
} )
301
+
302
+ // Github issue #6008
303
+ it ( 'should merge provide from mixins' , ( ) => {
304
+ const mixinA = { provide : { foo : 'foo' } }
305
+ const mixinB = { provide : { bar : 'bar' } }
306
+ const child = {
307
+ inject : [ 'foo' , 'bar' ] ,
308
+ template : `<span/>` ,
309
+ created ( ) {
310
+ injected = [ this . foo , this . bar ]
311
+ }
312
+ }
313
+ new Vue ( {
314
+ mixins : [ mixinA , mixinB ] ,
315
+ render ( h ) {
316
+ return h ( child )
317
+ }
318
+ } ) . $mount ( )
319
+
320
+ expect ( injected ) . toEqual ( [ 'foo' , 'bar' ] )
321
+ } )
322
+ it ( 'should merge provide from mixins and override existing keys' , ( ) => {
323
+ const mixinA = { provide : { foo : 'foo' } }
324
+ const mixinB = { provide : { foo : 'bar' } }
325
+ const child = {
326
+ inject : [ 'foo' ] ,
327
+ template : `<span/>` ,
328
+ created ( ) {
329
+ injected = [ this . foo ]
330
+ }
331
+ }
332
+ new Vue ( {
333
+ mixins : [ mixinA , mixinB ] ,
334
+ render ( h ) {
335
+ return h ( child )
336
+ }
337
+ } ) . $mount ( )
338
+
339
+ expect ( injected ) . toEqual ( [ 'bar' ] )
340
+ } )
301
341
} )
You can’t perform that action at this time.
0 commit comments