File tree Expand file tree Collapse file tree 2 files changed +3
-34
lines changed Expand file tree Collapse file tree 2 files changed +3
-34
lines changed Original file line number Diff line number Diff line change @@ -133,20 +133,11 @@ export const AvatarMixin = (superClass) =>
133133    /** @private  */ 
134134    __colorIndexChanged ( index )  { 
135135      if  ( index  !=  null )  { 
136-         const  prop  =  `--vaadin-user-color-${ index }  ` ; 
137- 
138-         // Check if custom CSS property is defined 
139-         const  isValid  =  Boolean ( getComputedStyle ( document . documentElement ) . getPropertyValue ( prop ) ) ; 
140- 
141-         if  ( isValid )  { 
142-           this . setAttribute ( 'has-color-index' ,  '' ) ; 
143-           this . style . setProperty ( '--vaadin-avatar-user-color' ,  `var(${ prop }  )` ) ; 
144-         }  else  { 
145-           this . removeAttribute ( 'has-color-index' ) ; 
146-           console . warn ( `The CSS property --vaadin-user-color-${ index }   is not defined` ) ; 
147-         } 
136+         this . setAttribute ( 'has-color-index' ,  '' ) ; 
137+         this . style . setProperty ( '--vaadin-avatar-user-color' ,  `var(--vaadin-user-color-${ index }  )` ) ; 
148138      }  else  { 
149139        this . removeAttribute ( 'has-color-index' ) ; 
140+         this . style . removeProperty ( '--vaadin-avatar-user-color' ) ; 
150141      } 
151142    } 
152143
Original file line number Diff line number Diff line change @@ -352,28 +352,6 @@ describe('vaadin-avatar', () => {
352352        expect ( avatar . hasAttribute ( 'has-color-index' ) ) . to . be . false ; 
353353      } ) ; 
354354    } ) ; 
355- 
356-     describe ( 'incorrect index' ,  ( )  =>  { 
357-       beforeEach ( ( )  =>  { 
358-         sinon . stub ( console ,  'warn' ) ; 
359-       } ) ; 
360- 
361-       afterEach ( ( )  =>  { 
362-         console . warn . restore ( ) ; 
363-       } ) ; 
364- 
365-       it ( 'should not set attribute for invalid index' ,  async  ( )  =>  { 
366-         avatar . colorIndex  =  99 ; 
367-         await  nextUpdate ( avatar ) ; 
368-         expect ( avatar . hasAttribute ( 'has-color-index' ) ) . to . be . false ; 
369-       } ) ; 
370- 
371-       it ( 'should warn about invalid css property used' ,  async  ( )  =>  { 
372-         avatar . colorIndex  =  99 ; 
373-         await  nextUpdate ( avatar ) ; 
374-         expect ( console . warn . called ) . to . be . true ; 
375-       } ) ; 
376-     } ) ; 
377355  } ) ; 
378356
379357  describe ( 'a11y' ,  ( )  =>  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments