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 = {
1111 var id = this . id = this . arg // bind-el ?
1212 ? scope . $eval ( this . expression )
1313 : 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+
1422 if ( refs . hasOwnProperty ( id ) ) {
1523 refs [ id ] = this . el
1624 } else {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ if (_.inBrowser) {
88 beforeEach ( function ( ) {
99 el = document . createElement ( 'div' )
1010 spyOn ( _ , 'warn' )
11+ spyOn ( _ , 'log' )
1112 } )
1213
1314 it ( 'normal' , function ( ) {
@@ -42,6 +43,19 @@ if (_.inBrowser) {
4243 } )
4344 } )
4445
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+
4559 it ( 'with v-repeat' , function ( done ) {
4660 var vm = new Vue ( {
4761 el : el ,
You can’t perform that action at this time.
0 commit comments