@@ -11,7 +11,8 @@ import {
11
11
VNodeCall ,
12
12
SlotsExpression ,
13
13
ObjectExpression ,
14
- SimpleExpressionNode
14
+ SimpleExpressionNode ,
15
+ RenderSlotCall
15
16
} from '../../src'
16
17
import { transformElement } from '../../src/transforms/transformElement'
17
18
import { transformOn } from '../../src/transforms/vOn'
@@ -788,6 +789,56 @@ describe('compiler: transform component slots', () => {
788
789
const { slots } = parseWithSlots ( `<Comp><Comp><slot/></Comp></Comp>` )
789
790
expect ( slots ) . toMatchObject ( toMatch )
790
791
} )
792
+
793
+ // # fix: #6900
794
+ test ( 'consistent behavior of @xxx:modelValue and @xxx:model-value' , ( ) => {
795
+ const { root : rootUpper } = parseWithSlots (
796
+ `<div><slot @foo:modelValue="handler" /></div>`
797
+ )
798
+ const slotNodeUpper = ( rootUpper . codegenNode ! as VNodeCall )
799
+ . children as ElementNode [ ]
800
+ const propertiesObjUpper = (
801
+ slotNodeUpper [ 0 ] . codegenNode ! as RenderSlotCall
802
+ ) . arguments [ 2 ]
803
+ expect ( propertiesObjUpper ) . toMatchObject ( {
804
+ properties : [
805
+ {
806
+ key : {
807
+ type : NodeTypes . SIMPLE_EXPRESSION ,
808
+ content : 'onFoo:modelValue'
809
+ } ,
810
+ value : {
811
+ type : NodeTypes . SIMPLE_EXPRESSION ,
812
+ content : `handler` ,
813
+ isStatic : false
814
+ }
815
+ }
816
+ ]
817
+ } )
818
+
819
+ const { root } = parseWithSlots (
820
+ `<div><slot @foo:model-Value="handler" /></div>`
821
+ )
822
+ const slotNode = ( root . codegenNode ! as VNodeCall )
823
+ . children as ElementNode [ ]
824
+ const propertiesObj = ( slotNode [ 0 ] . codegenNode ! as RenderSlotCall )
825
+ . arguments [ 2 ]
826
+ expect ( propertiesObj ) . toMatchObject ( {
827
+ properties : [
828
+ {
829
+ key : {
830
+ type : NodeTypes . SIMPLE_EXPRESSION ,
831
+ content : 'onFoo:modelValue'
832
+ } ,
833
+ value : {
834
+ type : NodeTypes . SIMPLE_EXPRESSION ,
835
+ content : `handler` ,
836
+ isStatic : false
837
+ }
838
+ }
839
+ ]
840
+ } )
841
+ } )
791
842
} )
792
843
793
844
describe ( 'errors' , ( ) => {
0 commit comments