File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/runtime-core/__tests__ Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,26 @@ describe('api: options', () => {
7878 test ( 'methods' , async ( ) => {
7979 const Comp = defineComponent ( {
8080 data ( ) {
81+ // #3300 method on ctx should be overwritable
82+ this . incBy = this . incBy . bind ( this , 2 )
8183 return {
8284 foo : 1
8385 }
8486 } ,
8587 methods : {
8688 inc ( ) {
8789 this . foo ++
90+ } ,
91+ incBy ( n = 0 ) {
92+ this . foo += n
8893 }
8994 } ,
9095 render ( ) {
9196 return h (
9297 'div' ,
9398 {
94- onClick : this . inc
99+ onClick : this . inc ,
100+ onFoo : this . incBy
95101 } ,
96102 this . foo
97103 )
@@ -104,6 +110,10 @@ describe('api: options', () => {
104110 triggerEvent ( root . children [ 0 ] as TestElement , 'click' )
105111 await nextTick ( )
106112 expect ( serializeInner ( root ) ) . toBe ( `<div>2</div>` )
113+
114+ triggerEvent ( root . children [ 0 ] as TestElement , 'foo' )
115+ await nextTick ( )
116+ expect ( serializeInner ( root ) ) . toBe ( `<div>4</div>` )
107117 } )
108118
109119 test ( 'component’s own methods have higher priority than global properties' , async ( ) => {
You can’t perform that action at this time.
0 commit comments