All files / app/components/role-icon role-icon.component.ts

100% Statements 36/36
64.28% Branches 9/14
100% Functions 3/3
100% Lines 36/36

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 361x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 23x 23x 23x 50x 50x 50x 50x 50x 50x 50x 50x 50x 50x 50x 50x 23x 23x 50x 50x 50x 50x 50x 23x
import { Component, Input } from "@angular/core";
import { Role } from "../../models/role";
 
@Component({
  selector: 'app-role-icon',
  standalone: true,
 
  template: `
    <div class="role-cell" [class]="cssClass()">{{ text() }}</div>
  `,
})
 
export class RoleIconComponent {
  @Input() role: Role = Role.VILLAGER;
 
  text() {
    switch (this.role) {
        case Role.GUARD: return "g";
        case Role.HEALER: return "h";
        case Role.VILLAGER: return "";
        case Role.WEREWOLF: return "W";
        case Role.PRINCE: return "p";
        case Role.MASON: return "m";
        case Role.SCOUT: return "s";
        case Role.LYCAN: return "L";
        default: return "?";
    }
  }
 
  cssClass() {
    switch (this.role) {
        case Role.WEREWOLF: return "role-icon-wolves";
        default: return "role-icon-village"
    }
  }
}