File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,14 @@ module.exports = {
11
11
var id = this . id = this . arg // bind-el ?
12
12
? scope . $eval ( this . expression )
13
13
: this . expression
14
+
15
+ if ( process . env . NODE_ENV !== 'production' && this . arg ) {
16
+ _ . log (
17
+ 'You are using bind- syntax on "el", which is a special ' +
18
+ 'attribute. It will be evaluated only once.'
19
+ )
20
+ }
21
+
14
22
if ( refs . hasOwnProperty ( id ) ) {
15
23
refs [ id ] = this . el
16
24
} else {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ if (_.inBrowser) {
8
8
beforeEach ( function ( ) {
9
9
el = document . createElement ( 'div' )
10
10
spyOn ( _ , 'warn' )
11
+ spyOn ( _ , 'log' )
11
12
} )
12
13
13
14
it ( 'normal' , function ( ) {
@@ -42,6 +43,19 @@ if (_.inBrowser) {
42
43
} )
43
44
} )
44
45
46
+ it ( 'bind-el' , function ( ) {
47
+ var vm = new Vue ( {
48
+ el : el ,
49
+ data : {
50
+ id : 'test'
51
+ } ,
52
+ template : '<div bind-el="id" id="test"></div>'
53
+ } )
54
+ expect ( vm . $$ . test ) . toBeTruthy ( )
55
+ expect ( vm . $$ . test . id ) . toBe ( 'test' )
56
+ expect ( _ . log ) . toHaveBeenCalled ( )
57
+ } )
58
+
45
59
it ( 'with v-repeat' , function ( done ) {
46
60
var vm = new Vue ( {
47
61
el : el ,
You can’t perform that action at this time.
0 commit comments