All files / src/components fit-chip.ts

100% Statements 10/10
100% Branches 10/10
100% Functions 2/2
100% Lines 10/10

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 141x     1x 66x 4x 4x   4x 4x 3x 1x 1x  
import { HARDWARE_FIT, type HardwareFit } from "../types";
import { MESSAGES } from "../locales/en";
 
export function renderFitChip(container: HTMLElement, fit: HardwareFit | null | undefined): void {
    if (fit !== HARDWARE_FIT.FITS && fit !== HARDWARE_FIT.TIGHT && fit !== HARDWARE_FIT.WONT_RUN) return;
    container.createEl("span", { text: fitLabel(fit), cls: `lilbee-fit-chip lilbee-fit-${fit}` });
}
 
function fitLabel(fit: HardwareFit): string {
    if (fit === HARDWARE_FIT.FITS) return MESSAGES.LABEL_FIT_FITS;
    if (fit === HARDWARE_FIT.TIGHT) return MESSAGES.LABEL_FIT_TIGHT;
    return MESSAGES.LABEL_FIT_WONT_RUN;
}