@@ -382,6 +382,7 @@ describe('Options provide/inject', () => {
382382
383383 expect ( injected ) . toEqual ( [ 'foo' , 'bar' ] )
384384 } )
385+
385386 it ( 'should merge provide from mixins (functions)' , ( ) => {
386387 const mixinA = { provide : ( ) => ( { foo : 'foo' } ) }
387388 const mixinB = { provide : ( ) => ( { bar : 'bar' } ) }
@@ -401,6 +402,7 @@ describe('Options provide/inject', () => {
401402
402403 expect ( injected ) . toEqual ( [ 'foo' , 'bar' ] )
403404 } )
405+
404406 it ( 'should merge provide from mixins (mix of objects and functions)' , ( ) => {
405407 const mixinA = { provide : { foo : 'foo' } }
406408 const mixinB = { provide : ( ) => ( { bar : 'bar' } ) }
@@ -422,6 +424,7 @@ describe('Options provide/inject', () => {
422424
423425 expect ( injected ) . toEqual ( [ 'foo' , 'bar' , 'baz' , 'bam' ] )
424426 } )
427+
425428 it ( 'should merge provide from mixins and override existing keys' , ( ) => {
426429 const mixinA = { provide : { foo : 'foo' } }
427430 const mixinB = { provide : { foo : 'bar' } }
@@ -441,6 +444,7 @@ describe('Options provide/inject', () => {
441444
442445 expect ( injected ) . toEqual ( [ 'bar' ] )
443446 } )
447+
444448 it ( 'should merge provide when Vue.extend' , ( ) => {
445449 const mixinA = { provide : ( ) => ( { foo : 'foo' } ) }
446450 const child = {
@@ -504,4 +508,41 @@ describe('Options provide/inject', () => {
504508 expect ( isObserver ( child . bar ) ) . toBe ( false )
505509 expect ( isObserver ( child . baz ) ) . toBe ( false )
506510 } )
511+
512+ // #6175
513+ it ( 'merge provide properly from mixins' , ( ) => {
514+ const ProvideFooMixin = {
515+ provide : {
516+ foo : 'foo injected'
517+ }
518+ }
519+
520+ const ProvideBarMixin = {
521+ provide : {
522+ bar : 'bar injected'
523+ }
524+ }
525+
526+ const Child = {
527+ inject : [ 'foo' , 'bar' ] ,
528+ render ( h ) {
529+ return h ( 'div' , [ `foo: ${ this . foo } , ` , `bar: ${ this . bar } ` ] )
530+ }
531+ }
532+
533+ const Parent = {
534+ mixins : [ ProvideFooMixin , ProvideBarMixin ] ,
535+ render ( h ) {
536+ return h ( Child )
537+ }
538+ }
539+
540+ const vm = new Vue ( {
541+ render ( h ) {
542+ return h ( Parent )
543+ }
544+ } ) . $mount ( )
545+
546+ expect ( vm . $el . textContent ) . toBe ( `foo: foo injected, bar: bar injected` )
547+ } )
507548} )
0 commit comments