File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export function compatCoerceAttr(
7979 }
8080 } else if (
8181 value === false &&
82+ ! ( el . tagName === 'INPUT' && key === 'value' ) &&
8283 ! isSpecialBooleanAttr ( key ) &&
8384 compatUtils . isCompatEnabled ( DeprecationTypes . ATTR_FALSE_VALUE , instance )
8485 ) {
Original file line number Diff line number Diff line change @@ -208,6 +208,20 @@ test('ATTR_FALSE_VALUE', () => {
208208 ) . toHaveBeenWarned ( )
209209} )
210210
211+ test ( 'ATTR_FALSE_VALUE with false on input value' , ( ) => {
212+ const vm = new Vue ( {
213+ template : `<input :value="false"/>` ,
214+ } ) . $mount ( )
215+ expect ( vm . $el ) . toBeInstanceOf ( HTMLInputElement )
216+ expect ( vm . $el . hasAttribute ( 'value' ) ) . toBe ( true )
217+ expect ( vm . $el . getAttribute ( 'value' ) ) . toBe ( 'false' )
218+ expect (
219+ ( deprecationData [ DeprecationTypes . ATTR_FALSE_VALUE ] . message as Function ) (
220+ 'value' ,
221+ ) ,
222+ ) . not . toHaveBeenWarned ( )
223+ } )
224+
211225test ( "ATTR_FALSE_VALUE with false value shouldn't throw warning" , ( ) => {
212226 const vm = new Vue ( {
213227 template : `<div :id="false" :foo="false"/>` ,
You can’t perform that action at this time.
0 commit comments