File tree 2 files changed +7
-6
lines changed
src/core/instance/render-helpers
test/unit/features/directives
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 7
7
isObject ,
8
8
toObject ,
9
9
isReservedAttribute ,
10
- camelize
10
+ camelize ,
11
+ hyphenate
11
12
} from 'core/util/index'
12
13
13
14
/**
@@ -45,12 +46,13 @@ export function bindObjectProps (
45
46
: data . attrs || ( data . attrs = { } )
46
47
}
47
48
const camelizedKey = camelize ( key )
48
- if ( ! ( key in hash ) && ! ( camelizedKey in hash ) ) {
49
+ const hyphenatedKey = hyphenate ( key )
50
+ if ( ! ( camelizedKey in hash ) && ! ( hyphenatedKey in hash ) ) {
49
51
hash [ key ] = value [ key ]
50
52
51
53
if ( isSync ) {
52
54
const on = data . on || ( data . on = { } )
53
- on [ `update:${ camelizedKey } ` ] = function ( $event ) {
55
+ on [ `update:${ key } ` ] = function ( $event ) {
54
56
value [ key ] = $event
55
57
}
56
58
}
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ describe('Directive v-bind', () => {
234
234
template : `<test v-bind="test" data-foo="foo" dataBar="bar"/>` ,
235
235
components : {
236
236
test : {
237
- template : '<div :data-foo=" dataFoo" :data-bar=" dataBar"> </div>' ,
237
+ template : '<div>{{ dataFoo }} {{ dataBar }} </div>' ,
238
238
props : [ 'dataFoo' , 'dataBar' ]
239
239
}
240
240
} ,
@@ -245,8 +245,7 @@ describe('Directive v-bind', () => {
245
245
}
246
246
}
247
247
} ) . $mount ( )
248
- expect ( vm . $el . getAttribute ( 'data-foo' ) ) . toBe ( 'foo' )
249
- expect ( vm . $el . getAttribute ( 'data-bar' ) ) . toBe ( 'bar' )
248
+ expect ( vm . $el . textContent ) . toBe ( 'foo bar' )
250
249
} )
251
250
252
251
it ( '.sync modifier with bind object' , done => {
You can’t perform that action at this time.
0 commit comments