@@ -11,7 +11,8 @@ import {
1111 VNodeCall ,
1212 SlotsExpression ,
1313 ObjectExpression ,
14- SimpleExpressionNode
14+ SimpleExpressionNode ,
15+ RenderSlotCall
1516} from '../../src'
1617import { transformElement } from '../../src/transforms/transformElement'
1718import { transformOn } from '../../src/transforms/vOn'
@@ -788,6 +789,56 @@ describe('compiler: transform component slots', () => {
788789 const { slots } = parseWithSlots ( `<Comp><Comp><slot/></Comp></Comp>` )
789790 expect ( slots ) . toMatchObject ( toMatch )
790791 } )
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+ } )
791842 } )
792843
793844 describe ( 'errors' , ( ) => {
0 commit comments