File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
packages/runtime-core/__tests__ Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -669,4 +669,39 @@ describe('component props', () => {
669669
670670 expect ( Object . keys ( props . msg ) . length ) . toBe ( 1 )
671671 } )
672+
673+ // #5517
674+ test ( 'events should not be props when component updating' , async ( ) => {
675+ let props
676+
677+ function eventHandler ( ) { }
678+
679+ const foo = ref ( 1 )
680+ const Child = defineComponent ( {
681+ setup ( _props ) {
682+ props = _props
683+ } ,
684+ emits : [ 'event' ] ,
685+ props : [ 'foo' ] ,
686+ template : `<div>{{ foo }}</div>`
687+ } )
688+
689+ const Comp = defineComponent ( {
690+ setup ( ) {
691+ return {
692+ foo,
693+ eventHandler
694+ }
695+ } ,
696+ components : { Child } ,
697+ template : `<Child @event="eventHandler" :foo="foo" />`
698+ } )
699+
700+ const root = document . createElement ( 'div' )
701+ domRender ( h ( Comp ) , root )
702+ expect ( props ) . not . toHaveProperty ( 'onEvent' )
703+ foo . value ++
704+ await nextTick ( )
705+ expect ( props ) . not . toHaveProperty ( 'onEvent' )
706+ } )
672707} )
You can’t perform that action at this time.
0 commit comments