All files / app/codeCharta/ui/ribbonBar/artificialIntelligence/highRiskProfile riskProfileBar.directive.ts

100% Statements 9/9
100% Branches 5/5
100% Functions 2/2
100% Lines 8/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 203x           3x 24x   24x     24x 24x 24x 24x        
import { Directive, ElementRef, Input, OnChanges, SimpleChanges } from "@angular/core"
 
@Directive({
    selector: "[ccRiskProfileBar]",
    standalone: true
})
export class RiskProfileBarDirective implements OnChanges {
    @Input() ccRiskProfileBar = 0
 
    constructor(private element: ElementRef) {}
 
    ngOnChanges(changes: SimpleChanges) {
        if (changes.ccRiskProfileBar) {
            this.element.nativeElement.style.display = this.ccRiskProfileBar > 0 ? "flex" : "none"
            this.element.nativeElement.style.width = `${this.ccRiskProfileBar}%`
            this.element.nativeElement.style.color = this.ccRiskProfileBar > 5 ? "black" : "rgba(0,0,0,0)"
        }
    }
}