All files / packages/sds-recipes/src/modules/c/avatar avatar.js

84.61% Statements 11/13
50% Branches 1/2
71.42% Functions 5/7
84.61% Lines 11/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                22x 22x 22x   22x 22x     16x                 6x 6x 6x             1x 1x                          
import { LightningElement, api } from 'lwc';
import { reflectAttribute } from 'sds/utils';
 
export default class Avatar extends LightningElement {
  // Render component in native shadow mode
  static shadowSupportMode = 'native';
 
  // Private variables
  _iconSize = 'x-small';
  _symbol = 'utility:user';
  _variant;
 
  // Public properties
  @api src;
  @api altText;
  @api
  get iconSize() {
    return this._iconSize;
  }
  set iconSize(value) {
    this._iconSize = value;
  }
 
  @api
  get symbol() {
    return this._symbol;
  E}
  set symbol(value) {
    this._symbol = value;
    if (this._symbol == 'utility:einstein') {
      this._iconSize = 'default';
    }
  }
 
  @api
  get variant() {
    return this._variant;
  }
 
  set variant(value) {
    this._variant = value;
    reflectAttribute(this, 'variant', value);
  }
 
  get computedClassNames() {
    return [this.src ? 'has-src' : 'has-fallback'].toString().replace(/,/g, ' ');
  }
}