File tree 2 files changed +2
-18
lines changed
test/unit/features/options
2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ import {
21
21
noop
22
22
} from '../util/index'
23
23
24
- import BuiltinVue from '../index'
25
-
26
24
export function initState ( vm : Component ) {
27
25
vm . _watchers = [ ]
28
26
initProps ( vm )
@@ -145,16 +143,12 @@ function initMethods (vm: Component) {
145
143
if ( methods ) {
146
144
for ( const key in methods ) {
147
145
vm [ key ] = methods [ key ] == null ? noop : bind ( methods [ key ] , vm )
148
- if ( process . env . NODE_ENV !== 'production' ) {
149
- methods [ key ] == null && warn (
146
+ if ( process . env . NODE_ENV !== 'production' && methods [ key ] == null ) {
147
+ warn (
150
148
`method "${ key } " has an undefined value in the component definition. ` +
151
149
`Did you reference the function correctly?` ,
152
150
vm
153
151
)
154
- hasOwn ( BuiltinVue . prototype , key ) && warn (
155
- `Avoid overriding Vue's internal method "${ key } ".` ,
156
- vm
157
- )
158
152
}
159
153
}
160
154
}
Original file line number Diff line number Diff line change @@ -24,14 +24,4 @@ describe('Options methods', () => {
24
24
} )
25
25
expect ( `method "hello" has an undefined value in the component definition` ) . toHaveBeenWarned ( )
26
26
} )
27
-
28
- it ( 'should warn overriding builtin methods' , ( ) => {
29
- new Vue ( {
30
- methods : {
31
- $emit ( ) {
32
- }
33
- }
34
- } )
35
- expect ( `Avoid overriding Vue's internal method "$emit".` ) . toHaveBeenWarned ( )
36
- } )
37
27
} )
You can’t perform that action at this time.
0 commit comments