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 6
6
getAttr ,
7
7
getBindAttr ,
8
8
camelize ,
9
+ hyphenate ,
9
10
nextTick ,
10
11
warn
11
12
} from './util/index'
@@ -166,7 +167,7 @@ Directive.prototype._setupParams = function () {
166
167
var i = params . length
167
168
var key , val , mappedKey
168
169
while ( i -- ) {
169
- key = params [ i ]
170
+ key = hyphenate ( params [ i ] )
170
171
mappedKey = camelize ( key )
171
172
val = getBindAttr ( this . el , key )
172
173
if ( val != null ) {
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ describe('Directive', function () {
7
7
beforeEach ( function ( ) {
8
8
el = document . createElement ( 'div' )
9
9
def = {
10
- params : [ 'foo' ] ,
10
+ params : [ 'foo' , 'keBab' ] ,
11
11
paramWatchers : {
12
12
foo : jasmine . createSpy ( 'foo' )
13
13
} ,
@@ -159,24 +159,28 @@ describe('Directive', function () {
159
159
160
160
it ( 'static params' , function ( ) {
161
161
el . setAttribute ( 'foo' , 'hello' )
162
+ el . setAttribute ( 'ke-bab' , 'yo' )
162
163
var d = new Directive ( {
163
164
name : 'test' ,
164
165
def : def ,
165
166
expression : 'a'
166
167
} , vm , el )
167
168
d . _bind ( )
168
169
expect ( d . params . foo ) . toBe ( 'hello' )
170
+ expect ( d . params . keBab ) . toBe ( 'yo' )
169
171
} )
170
172
171
173
it ( 'dynamic params' , function ( done ) {
172
174
el . setAttribute ( ':foo' , 'a' )
175
+ el . setAttribute ( ':ke-bab' , '123' )
173
176
var d = new Directive ( {
174
177
name : 'test' ,
175
178
def : def ,
176
179
expression : 'a'
177
180
} , vm , el )
178
181
d . _bind ( )
179
182
expect ( d . params . foo ) . toBe ( vm . a )
183
+ expect ( d . params . keBab ) . toBe ( 123 )
180
184
vm . a = 2
181
185
nextTick ( function ( ) {
182
186
expect ( def . paramWatchers . foo ) . toHaveBeenCalledWith ( 2 , 1 )
You can’t perform that action at this time.
0 commit comments