File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 66 getAttr ,
77 getBindAttr ,
88 camelize ,
9+ hyphenate ,
910 nextTick ,
1011 warn
1112} from './util/index'
@@ -166,7 +167,7 @@ Directive.prototype._setupParams = function () {
166167 var i = params . length
167168 var key , val , mappedKey
168169 while ( i -- ) {
169- key = params [ i ]
170+ key = hyphenate ( params [ i ] )
170171 mappedKey = camelize ( key )
171172 val = getBindAttr ( this . el , key )
172173 if ( val != null ) {
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ describe('Directive', function () {
77 beforeEach ( function ( ) {
88 el = document . createElement ( 'div' )
99 def = {
10- params : [ 'foo' ] ,
10+ params : [ 'foo' , 'keBab' ] ,
1111 paramWatchers : {
1212 foo : jasmine . createSpy ( 'foo' )
1313 } ,
@@ -159,24 +159,28 @@ describe('Directive', function () {
159159
160160 it ( 'static params' , function ( ) {
161161 el . setAttribute ( 'foo' , 'hello' )
162+ el . setAttribute ( 'ke-bab' , 'yo' )
162163 var d = new Directive ( {
163164 name : 'test' ,
164165 def : def ,
165166 expression : 'a'
166167 } , vm , el )
167168 d . _bind ( )
168169 expect ( d . params . foo ) . toBe ( 'hello' )
170+ expect ( d . params . keBab ) . toBe ( 'yo' )
169171 } )
170172
171173 it ( 'dynamic params' , function ( done ) {
172174 el . setAttribute ( ':foo' , 'a' )
175+ el . setAttribute ( ':ke-bab' , '123' )
173176 var d = new Directive ( {
174177 name : 'test' ,
175178 def : def ,
176179 expression : 'a'
177180 } , vm , el )
178181 d . _bind ( )
179182 expect ( d . params . foo ) . toBe ( vm . a )
183+ expect ( d . params . keBab ) . toBe ( 123 )
180184 vm . a = 2
181185 nextTick ( function ( ) {
182186 expect ( def . paramWatchers . foo ) . toHaveBeenCalledWith ( 2 , 1 )
You can’t perform that action at this time.
0 commit comments