File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ export const proxyComponent = (
344344          // test whether this property either has no 'getter' or if it does, does it also have a 'setter' 
345345          // before attempting to write back to component props 
346346          newValue  =  newValue  ===  null  &&  typeof  this [ propName ]  ===  'boolean'  ? ( false  as  any )  : newValue ; 
347-           if  ( newValue  !==   this [ propName ]  &&  ( ! propDesc . get  ||  ! ! propDesc . set ) )  { 
347+           if  ( newValue  !=  this [ propName ]  &&  ( ! propDesc . get  ||  ! ! propDesc . set ) )  { 
348348            this [ propName ]  =  newValue ; 
349349          } 
350350        } ) ; 
Original file line number Diff line number Diff line change @@ -125,4 +125,28 @@ describe('prop', () => {
125125
126126    expect ( spy ) . not . toHaveBeenCalled ( ) ; 
127127  } ) ; 
128+ 
129+   it ( 'should not show warning setting reflected prop to undefined' ,  async  ( )  =>  { 
130+     @Component ( {  tag : 'cmp-a'  } ) 
131+     class  CmpA  { 
132+       @Prop ( {  reflect : true  } )  a  =  1 ; 
133+ 
134+       render ( )  { 
135+         return  `${ this . a  ? this . a  : '' }  ; 
136+       } 
137+     } 
138+ 
139+     const  {  root,  waitForChanges }  =  await  newSpecPage ( { 
140+       components : [ CmpA ] , 
141+       html : `<cmp-a></cmp-a>` , 
142+     } ) ; 
143+ 
144+     expect ( root ) . toEqualHtml ( '<cmp-a a="1">1</cmp-a>' ) ; 
145+ 
146+     root . a  =  undefined ; 
147+     await  waitForChanges ( ) ; 
148+ 
149+     expect ( root ) . toEqualHtml ( '<cmp-a></cmp-a>' ) ; 
150+     expect ( spy ) . not . toHaveBeenCalled ( ) ; 
151+   } ) ; 
128152} ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments