72 lines
3.5 KiB
TypeScript
72 lines
3.5 KiB
TypeScript
// Toasts/Tests/FT_ToastsToastCreation.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 { UEArray } from '#root/UE/UEArray.ts';
|
|
import { E_MessageType } from '#root/UI/Enums/E_MessageType.ts';
|
|
|
|
/**
|
|
* Functional Test: Toast Creation by Message Type
|
|
* Validates toast creation functionality for all message types
|
|
* Tests that each type (Info, Success, Warning, Error, Debug) creates valid toasts
|
|
*/
|
|
export class FT_ToastsToastCreation extends FunctionalTest {
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// GRAPHS
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
// EventGraph
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
|
|
/**
|
|
* Test execution - validates toast creation for each message type
|
|
* Iterates through all message types and verifies successful creation
|
|
*/
|
|
EventStartTest(): void {
|
|
this.ToastComponent.InitializeToastSystem();
|
|
|
|
this.ToastTypes.forEach(arrayElement => {
|
|
// Create toast for current message type and check if valid ID is returned
|
|
if (
|
|
this.ToastComponent.ShowToast(
|
|
`Test ${arrayElement} message`,
|
|
arrayElement,
|
|
1
|
|
) <= 0
|
|
) {
|
|
this.FinishTest(
|
|
EFunctionalTestResult.Failed,
|
|
`Failed to create ${arrayElement} toast`
|
|
);
|
|
}
|
|
});
|
|
|
|
this.FinishTest(EFunctionalTestResult.Succeeded);
|
|
}
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// VARIABLES
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
/**
|
|
* Toast notification system - component under test
|
|
* @category Components
|
|
*/
|
|
private ToastComponent = new AC_ToastSystem();
|
|
|
|
/**
|
|
* Array of all message types to test
|
|
* Covers complete range of supported toast types
|
|
* @category Test Data
|
|
*/
|
|
private ToastTypes: UEArray<E_MessageType> = new UEArray([
|
|
E_MessageType.Info,
|
|
E_MessageType.Success,
|
|
E_MessageType.Warning,
|
|
E_MessageType.Error,
|
|
E_MessageType.Debug,
|
|
]);
|
|
}
|