ts-ui-test/src/ui/progress-bar.ts

37 lines
998 B
TypeScript
Raw Normal View History

2023-05-02 16:44:10 +00:00
import { UINode } from "./node";
export class ProgressBar extends UINode {
private progressElement: HTMLProgressElement;
public constructor(title: string, max: number) {
super(title);
this.progressElement = document.createElement("progress");
this.progressElement.max = max;
this.element.appendChild(this.progressElement);
this.element.setAttribute("aria-label", title);
}
public getElement(): HTMLElement {
return this.progressElement;
}
public setText(text: string) {
this.title = text;
this.element.setAttribute("aria-label", text);
}
public getValue(): number {
return this.progressElement.value;
}
public setValue(value: number) {
this.progressElement.value = value;
}
public getMax(): number {
return this.progressElement.max;
}
public setMax(max: number) {
this.progressElement.max = max;
}
}