File tree 1 file changed +11
-1
lines changed
packages/runtime-core/__tests__
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,26 @@ describe('api: options', () => {
78
78
test ( 'methods' , async ( ) => {
79
79
const Comp = defineComponent ( {
80
80
data ( ) {
81
+ // #3300 method on ctx should be overwritable
82
+ this . incBy = this . incBy . bind ( this , 2 )
81
83
return {
82
84
foo : 1
83
85
}
84
86
} ,
85
87
methods : {
86
88
inc ( ) {
87
89
this . foo ++
90
+ } ,
91
+ incBy ( n = 0 ) {
92
+ this . foo += n
88
93
}
89
94
} ,
90
95
render ( ) {
91
96
return h (
92
97
'div' ,
93
98
{
94
- onClick : this . inc
99
+ onClick : this . inc ,
100
+ onFoo : this . incBy
95
101
} ,
96
102
this . foo
97
103
)
@@ -104,6 +110,10 @@ describe('api: options', () => {
104
110
triggerEvent ( root . children [ 0 ] as TestElement , 'click' )
105
111
await nextTick ( )
106
112
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>` )
107
117
} )
108
118
109
119
test ( 'component’s own methods have higher priority than global properties' , async ( ) => {
You can’t perform that action at this time.
0 commit comments