File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
test/unit/specs/directives/internal Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -197,9 +197,13 @@ function makePropsLinkFn (props) {
197
197
initProp ( vm , prop , value )
198
198
} else {
199
199
// string literal, but we need to cater for
200
- // Boolean props with no value
201
- value = options . type === Boolean && raw === ''
202
- ? true
200
+ // Boolean props with no value, or with same
201
+ // literal value (e.g. disabled="disabled")
202
+ // see https://github.com/vuejs/vue-loader/issues/182
203
+ value = (
204
+ options . type === Boolean &&
205
+ ( raw === '' || raw === hyphenate ( prop . name ) )
206
+ ) ? true
203
207
: raw
204
208
initProp ( vm , prop , value )
205
209
}
Original file line number Diff line number Diff line change @@ -626,18 +626,20 @@ describe('prop', function () {
626
626
it ( 'treat boolean props properly' , function ( ) {
627
627
var vm = new Vue ( {
628
628
el : el ,
629
- template : '<comp v-ref:child prop-a></comp>' ,
629
+ template : '<comp v-ref:child prop-a prop-b="prop-b" ></comp>' ,
630
630
components : {
631
631
comp : {
632
632
props : {
633
633
propA : Boolean ,
634
- propB : Boolean
634
+ propB : Boolean ,
635
+ propC : Boolean
635
636
}
636
637
}
637
638
}
638
639
} )
639
640
expect ( vm . $refs . child . propA ) . toBe ( true )
640
- expect ( vm . $refs . child . propB ) . toBe ( false )
641
+ expect ( vm . $refs . child . propB ) . toBe ( true )
642
+ expect ( vm . $refs . child . propC ) . toBe ( false )
641
643
} )
642
644
643
645
it ( 'detect possible camelCase prop usage' , function ( ) {
You can’t perform that action at this time.
0 commit comments