File tree 1 file changed +35
-0
lines changed
packages/runtime-core/__tests__
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -749,4 +749,39 @@ describe('component props', () => {
749
749
expect ( `Invalid prop name: "ref"` ) . toHaveBeenWarned ( )
750
750
expect ( `Invalid prop name: "$foo"` ) . toHaveBeenWarned ( )
751
751
} )
752
+
753
+ // #5517
754
+ test ( 'events should not be props when component updating' , async ( ) => {
755
+ let props : any
756
+ function eventHandler ( ) { }
757
+ const foo = ref ( 1 )
758
+
759
+ const Child = defineComponent ( {
760
+ setup ( _props ) {
761
+ props = _props
762
+ } ,
763
+ emits : [ 'event' ] ,
764
+ props : [ 'foo' ] ,
765
+ template : `<div>{{ foo }}</div>` ,
766
+ } )
767
+
768
+ const Comp = defineComponent ( {
769
+ setup ( ) {
770
+ return {
771
+ foo,
772
+ eventHandler,
773
+ }
774
+ } ,
775
+ components : { Child } ,
776
+ template : `<Child @event="eventHandler" :foo="foo" />` ,
777
+ } )
778
+
779
+ const root = document . createElement ( 'div' )
780
+ domRender ( h ( Comp ) , root )
781
+ expect ( props ) . not . toHaveProperty ( 'onEvent' )
782
+
783
+ foo . value ++
784
+ await nextTick ( )
785
+ expect ( props ) . not . toHaveProperty ( 'onEvent' )
786
+ } )
752
787
} )
You can’t perform that action at this time.
0 commit comments