@@ -538,6 +538,96 @@ describe('component props', () => {
538
538
expect ( renderProxy . $props ) . toMatchObject ( props )
539
539
} )
540
540
541
+ test ( 'merging props from global mixins and extends' , ( ) => {
542
+ let renderProxy : any
543
+ let extendedRenderProxy : any
544
+
545
+ const defaultProp = ' from global'
546
+ const props = {
547
+ globalProp : {
548
+ type : String ,
549
+ default : defaultProp ,
550
+ } ,
551
+ }
552
+ const globalMixin = {
553
+ props,
554
+ }
555
+ const Comp = {
556
+ render ( this : any ) {
557
+ renderProxy = this
558
+ return h ( 'div' , [ 'Comp' , this . globalProp ] )
559
+ } ,
560
+ }
561
+ const ExtendedComp = {
562
+ extends : Comp ,
563
+ render ( this : any ) {
564
+ extendedRenderProxy = this
565
+ return h ( 'div' , [ 'ExtendedComp' , this . globalProp ] )
566
+ } ,
567
+ }
568
+
569
+ const app = createApp (
570
+ {
571
+ render : ( ) => [ h ( ExtendedComp ) , h ( Comp ) ] ,
572
+ } ,
573
+ { } ,
574
+ )
575
+ app . mixin ( globalMixin )
576
+
577
+ const root = nodeOps . createElement ( 'div' )
578
+ app . mount ( root )
579
+
580
+ expect ( serializeInner ( root ) ) . toMatch (
581
+ `<div>ExtendedComp from global</div><div>Comp from global</div>` ,
582
+ )
583
+ expect ( renderProxy . $props ) . toMatchObject ( { globalProp : defaultProp } )
584
+ expect ( extendedRenderProxy . $props ) . toMatchObject ( {
585
+ globalProp : defaultProp ,
586
+ } )
587
+ } )
588
+
589
+ test ( 'merging props for a component that is also used as a mixin' , ( ) => {
590
+ const CompA = {
591
+ render ( this : any ) {
592
+ return this . foo
593
+ } ,
594
+ }
595
+
596
+ const mixin = {
597
+ props : {
598
+ foo : {
599
+ default : 'from mixin' ,
600
+ } ,
601
+ } ,
602
+ }
603
+
604
+ const CompB = {
605
+ mixins : [ mixin , CompA ] ,
606
+ render ( this : any ) {
607
+ return this . foo
608
+ } ,
609
+ }
610
+
611
+ const app = createApp ( {
612
+ render ( ) {
613
+ return [ h ( CompA ) , ', ' , h ( CompB ) ]
614
+ } ,
615
+ } )
616
+
617
+ app . mixin ( {
618
+ props : {
619
+ foo : {
620
+ default : 'from global mixin' ,
621
+ } ,
622
+ } ,
623
+ } )
624
+
625
+ const root = nodeOps . createElement ( 'div' )
626
+ app . mount ( root )
627
+
628
+ expect ( serializeInner ( root ) ) . toMatch ( `from global mixin, from mixin` )
629
+ } )
630
+
541
631
test ( 'props type support BigInt' , ( ) => {
542
632
const Comp = {
543
633
props : {
0 commit comments