This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,13 @@ export function compatCoerceAttr(
7676 } else if (
7777 value === false &&
7878 ! isSpecialBooleanAttr ( key ) &&
79- compatUtils . softAssertCompatEnabled (
79+ compatUtils . isCompatEnabled ( DeprecationTypes . ATTR_FALSE_VALUE , instance )
80+ ) {
81+ compatUtils . warnDeprecation (
8082 DeprecationTypes . ATTR_FALSE_VALUE ,
8183 instance ,
8284 key ,
8385 )
84- ) {
8586 el . removeAttribute ( key )
8687 return true
8788 }
Original file line number Diff line number Diff line change @@ -208,6 +208,31 @@ test('ATTR_FALSE_VALUE', () => {
208208 ) . toHaveBeenWarned ( )
209209} )
210210
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+
211236test ( 'ATTR_ENUMERATED_COERCION' , ( ) => {
212237 const vm = new Vue ( {
213238 template : `<div :draggable="null" :spellcheck="0" contenteditable="foo" />` ,
You can’t perform that action at this time.
0 commit comments