66 lines
3.3 KiB
TypeScript
66 lines
3.3 KiB
TypeScript
// Toasts/Tests/FT_ToastsDurationHandling.ts
|
|
|
|
import { AC_ToastSystem } from '#root/Toasts/Components/AC_ToastSystem.ts';
|
|
import { EFunctionalTestResult } from '#root/UE/EFunctionalTestResult.ts';
|
|
import { FunctionalTest } from '#root/UE/FunctionalTest.ts';
|
|
import type { Integer } from '#root/UE/Integer.ts';
|
|
|
|
/**
|
|
* Functional Test: Toast Duration and Lifecycle Management
|
|
* Validates basic toast creation and ID assignment functionality
|
|
* Tests that toasts return valid IDs when created successfully
|
|
*/
|
|
export class FT_ToastsDurationHandling extends FunctionalTest {
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// GRAPHS
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
// EventGraph
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
|
|
/**
|
|
* Test execution - validates basic toast creation functionality
|
|
* Creates two toasts and verifies they return valid IDs
|
|
*/
|
|
EventStartTest(): void {
|
|
this.ToastComponent.InitializeToastSystem();
|
|
this.toast1 = this.ToastComponent.ShowToast();
|
|
this.toast2 = this.ToastComponent.ShowToast();
|
|
|
|
/**
|
|
* Check if both toasts were created successfully by verifying positive IDs
|
|
*/
|
|
const AreToastsCreatedSuccessfully = (): boolean =>
|
|
this.toast1 > 0 && this.toast2 > 0;
|
|
|
|
if (AreToastsCreatedSuccessfully()) {
|
|
this.FinishTest(EFunctionalTestResult.Succeeded);
|
|
} else {
|
|
this.FinishTest(EFunctionalTestResult.Failed, `Failed to create toasts`);
|
|
}
|
|
}
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// VARIABLES
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
/**
|
|
* Toast notification system - component under test
|
|
* @category Components
|
|
*/
|
|
private ToastComponent = new AC_ToastSystem();
|
|
|
|
/**
|
|
* ID of first test toast
|
|
* @category Test State
|
|
*/
|
|
private toast1: Integer = 0;
|
|
|
|
/**
|
|
* ID of second test toast
|
|
* @category Test State
|
|
*/
|
|
private toast2: Integer = 0;
|
|
}
|