dynamic-forms-material / Class

MaterialFormTestUtils

Utility class for testing material dynamic forms

Static Methods

static

assertFormValue()

Asserts that the form has a specific value

Presentation
static assertFormValue(component: DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>, expectedValue: Record<string, unknown>): void;
Parameters
NameTypeDescription
component
DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>
expectedValue
Record<string, unknown>
Returns
void
static

assertMatFieldError()

Asserts that a material field shows an error message

Presentation
static assertMatFieldError(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, fieldSelector: string, expectedError?: string | undefined): void;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
fieldSelector
string
expectedError
string | undefined
Returns
void
static

assertMatFieldValue()

Asserts that a material field has a specific value

Presentation
static assertMatFieldValue(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, fieldSelector: string, expectedValue: string): void;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
fieldSelector
string
expectedValue
string
Returns
void
static

assertMatFormFieldAppearance()

Asserts that a material form field has the correct appearance

Presentation
static assertMatFormFieldAppearance(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, fieldSelector: string, appearance: string): void;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
fieldSelector
string
appearance
string
Returns
void
static

builder()

Creates a new material form config builder

Presentation
static builder(): MaterialFormConfigBuilder;
Returns
static async

createTest()

Creates a material dynamic form test setup with proper providers

Presentation
async static createTest(testConfig: MaterialFormTestConfig): Promise<MaterialFormTestResult>;
Parameters
NameTypeDescription
testConfig
MaterialFormTestConfig
Returns
static

getFormErrors()

Gets validation errors from the component

Presentation
static getFormErrors(component: DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>): any[];
Parameters
NameTypeDescription
component
DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>
Returns
any[]
static

getFormValue()

Gets the current form value from the component

Presentation
static getFormValue(component: DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>): Record<string, unknown>;
Parameters
NameTypeDescription
component
DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>
Returns
Record<string, unknown>
static

getMatFieldElements()

Gets all material field elements from the fixture

Presentation
static getMatFieldElements(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, fieldType: string): NodeListOf<Element>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
fieldType
string
Returns
NodeListOf<Element>
static

isFormValid()

Checks if the form is valid

Presentation
static isFormValid(component: DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>): boolean;
Parameters
NameTypeDescription
component
DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>
Returns
boolean
static async

simulateMatButtonClick()

Simulates material button click

Presentation
async static simulateMatButtonClick(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, selector: string): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
selector
string
Returns
Promise<void>
static async

simulateMatCheckbox()

Simulates material checkbox toggle

Presentation
async static simulateMatCheckbox(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, selector: string, checked: boolean): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
selector
string
checked
boolean
Returns
Promise<void>
static async

simulateMatInput()

Simulates user input on a material input field

Presentation
async static simulateMatInput(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, selector: string, value: string): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
selector
string
value
string
Returns
Promise<void>
static async

simulateMatSelect()

Simulates user selection on a material select

Presentation
async static simulateMatSelect(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, selectSelector: string, value: string): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
selectSelector
string
value
string
Returns
Promise<void>
static async

simulateMatToggle()

Simulates material toggle switch

Presentation
async static simulateMatToggle(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>, selector: string, checked: boolean): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
selector
string
checked
boolean
Returns
Promise<void>
static async

waitForInit()

Waits for the material dynamic form to initialize

Presentation
async static waitForInit(fixture: ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>): Promise<void>;
Parameters
NameTypeDescription
fixture
ComponentFixture<DynamicForm<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; } & Record<string, unknown>>>
Returns
Promise<void>