File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
test/unit/specs/directives/public Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,8 @@ module.exports = {
5
5
priority : 1500 ,
6
6
7
7
bind : function ( ) {
8
+ /* istanbul ignore if */
8
9
if ( ! this . arg ) {
9
- process . env . NODE_ENV !== 'production' && _ . warn (
10
- 'v-el requires an argument.'
11
- )
12
10
return
13
11
}
14
12
var id = this . id = _ . camelize ( this . arg )
@@ -21,7 +19,6 @@ module.exports = {
21
19
} ,
22
20
23
21
unbind : function ( ) {
24
- if ( ! this . id ) return
25
22
var refs = ( this . _scope || this . vm ) . $els
26
23
if ( refs [ this . id ] === this . el ) {
27
24
refs [ this . id ] = null
Original file line number Diff line number Diff line change @@ -115,5 +115,13 @@ if (_.inBrowser) {
115
115
done ( )
116
116
} )
117
117
} )
118
+
119
+ it ( 'warn when used on non-component node' , function ( ) {
120
+ new Vue ( {
121
+ el : el ,
122
+ template : '<div v-ref:test></div>'
123
+ } )
124
+ expect ( hasWarned ( _ , 'must be used on a child component' ) ) . toBe ( true )
125
+ } )
118
126
} )
119
127
}
You can’t perform that action at this time.
0 commit comments