File tree 2 files changed +28
-2
lines changed
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,13 @@ export function compatCoerceAttr(
76
76
} else if (
77
77
value === false &&
78
78
! isSpecialBooleanAttr ( key ) &&
79
- compatUtils . softAssertCompatEnabled (
79
+ compatUtils . isCompatEnabled ( DeprecationTypes . ATTR_FALSE_VALUE , instance )
80
+ ) {
81
+ compatUtils . warnDeprecation (
80
82
DeprecationTypes . ATTR_FALSE_VALUE ,
81
83
instance ,
82
84
key ,
83
85
)
84
- ) {
85
86
el . removeAttribute ( key )
86
87
return true
87
88
}
Original file line number Diff line number Diff line change @@ -208,6 +208,31 @@ test('ATTR_FALSE_VALUE', () => {
208
208
) . toHaveBeenWarned ( )
209
209
} )
210
210
211
+ test ( "ATTR_FALSE_VALUE with false value shouldn't throw warning" , ( ) => {
212
+ const vm = new Vue ( {
213
+ template : `<div :id="false" :foo="false"/>` ,
214
+ compatConfig : {
215
+ ATTR_FALSE_VALUE : false ,
216
+ } ,
217
+ } ) . $mount ( )
218
+
219
+ expect ( vm . $el ) . toBeInstanceOf ( HTMLDivElement )
220
+ expect ( vm . $el . hasAttribute ( 'id' ) ) . toBe ( true )
221
+ expect ( vm . $el . getAttribute ( 'id' ) ) . toBe ( 'false' )
222
+ expect ( vm . $el . hasAttribute ( 'foo' ) ) . toBe ( true )
223
+ expect ( vm . $el . getAttribute ( 'foo' ) ) . toBe ( 'false' )
224
+ expect (
225
+ ( deprecationData [ DeprecationTypes . ATTR_FALSE_VALUE ] . message as Function ) (
226
+ 'id' ,
227
+ ) ,
228
+ ) . not . toHaveBeenWarned ( )
229
+ expect (
230
+ ( deprecationData [ DeprecationTypes . ATTR_FALSE_VALUE ] . message as Function ) (
231
+ 'foo' ,
232
+ ) ,
233
+ ) . not . toHaveBeenWarned ( )
234
+ } )
235
+
211
236
test ( 'ATTR_ENUMERATED_COERCION' , ( ) => {
212
237
const vm = new Vue ( {
213
238
template : `<div :draggable="null" :spellcheck="0" contenteditable="foo" />` ,
You can’t perform that action at this time.
0 commit comments