fixed tests

This commit is contained in:
2025-09-05 00:36:54 -04:00
commit a536668a0b
48 changed files with 8187 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
import type { IUIController } from '../interfaces/IWebRTCClient.ts';
export class UIController implements IUIController {
private statusElement: HTMLElement;
private subscribersCountElement: HTMLElement | null;
private startButton: HTMLButtonElement | null;
private stopButton: HTMLButtonElement | null;
constructor(
statusElementId: string,
subscribersCountElementId?: string,
startButtonId?: string,
stopButtonId?: string
) {
this.statusElement = document.getElementById(statusElementId)!;
this.subscribersCountElement = subscribersCountElementId
? document.getElementById(subscribersCountElementId)
: null;
this.startButton = startButtonId
? document.getElementById(startButtonId) as HTMLButtonElement
: null;
this.stopButton = stopButtonId
? document.getElementById(stopButtonId) as HTMLButtonElement
: null;
}
updateStatus(status: string, className: string): void {
this.statusElement.textContent = status;
this.statusElement.className = `status ${className}`;
}
updateSubscribersCount(count: number): void {
if (this.subscribersCountElement) {
this.subscribersCountElement.textContent = `Subscribers: ${count}`;
}
}
setButtonStates(startEnabled: boolean, stopEnabled: boolean): void {
if (this.startButton) {
this.startButton.disabled = !startEnabled;
}
if (this.stopButton) {
this.stopButton.disabled = !stopEnabled;
}
}
onButtonClick(buttonId: string, handler: () => void): void {
const button = document.getElementById(buttonId);
if (button) {
button.addEventListener('click', handler);
}
}
}