All files / src/lib/tl-themes tl-themes.component.ts

88.89% Statements 8/9
50% Branches 2/4
100% Functions 2/2
87.5% Lines 7/8

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                    1x       1x   1x     1x             1x 1x 1x          
import { Component, Input, OnInit } from '@angular/core';
import { actions } from '@wvr/elements';
import { TamuAbstractBaseComponent } from '../shared/tl-abstract-base.component';
import { themes } from '../shared/themes';
 
@Component({
  selector: 'tl-themes-component',
  templateUrl: './tl-themes.component.html',
  styleUrls: ['./tl-themes.component.scss']
})
export class TlThemesComponent extends TamuAbstractBaseComponent implements OnInit {
 
  private _themeName;
  @Input() set activeTheme(name: string) {
    Eif (Object.keys(themes)
          .includes(name)) {
      this.store.dispatch(actions.Theme.select({
        name
      }));
      this._themeName = name;
    } else {
      console.warn(`'${name}' is not a known theme!`);
    }
  }
 
  ngOnInit(): void {
    super.ngOnInit();
    Eif (!this._themeName) {
      this.activeTheme = 'tamu';
    }
  }
 
}