PrimeNGFormTestUtils
Utility class for testing PrimeNG dynamic forms
Static Methods
static assertFormValue() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Asserts that the form has a specific value | |||||||||
Presentation | |||||||||
Parameters
Returnsvoid |
static assertPrimeFieldError() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Asserts that a PrimeNG field shows an error message | ||||||||||||
Presentation | ||||||||||||
Parameters
Returnsvoid |
static assertPrimeFieldValue() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Asserts that a PrimeNG field has a specific value | ||||||||||||
Presentation | ||||||||||||
Parameters
Returnsvoid |
static builder() |
|---|
Creates a new PrimeNG form config builder |
Presentation |
Returns |
static async createTest() | ||||||
|---|---|---|---|---|---|---|
Creates a PrimeNG dynamic form test setup with proper providers | ||||||
Presentation | ||||||
Parameters
ReturnsPromise< |
static getFormErrors() | ||||||
|---|---|---|---|---|---|---|
Gets validation errors from the component | ||||||
Presentation | ||||||
Parameters
Returnsunknown[] |
static getFormValue() | ||||||
|---|---|---|---|---|---|---|
Gets the current form value from the component | ||||||
Presentation | ||||||
Parameters
ReturnsRecord<string, unknown> |
static getPButton() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG button element | |||||||||
Presentation | |||||||||
Parameters
ReturnsHTMLButtonElement |
static getPCalendar() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG calendar (datepicker) element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPCheckbox() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG checkbox element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPDropdown() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG dropdown element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPInputSwitch() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG InputSwitch (toggle) element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPInputText() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG input text element | |||||||||
Presentation | |||||||||
Parameters
ReturnsHTMLInputElement |
static getPRadioButton() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG radio button element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPrimeFieldElements() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets all PrimeNG field elements from the fixture | |||||||||
Presentation | |||||||||
Parameters
ReturnsNodeListOf<Element> |
static getPSlider() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG slider element | |||||||||
Presentation | |||||||||
Parameters
ReturnsElement |
static getPTextarea() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Gets a PrimeNG textarea element | |||||||||
Presentation | |||||||||
Parameters
ReturnsHTMLTextAreaElement |
static isFormValid() | ||||||
|---|---|---|---|---|---|---|
Checks if the form is valid | ||||||
Presentation | ||||||
Parameters
Returnsboolean |
static async simulatePrimeButtonClick() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Simulates PrimeNG button click | |||||||||
Presentation | |||||||||
Parameters
ReturnsPromise<void> |
static async simulatePrimeCheckbox() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Simulates PrimeNG checkbox toggle | ||||||||||||
Presentation | ||||||||||||
Parameters
ReturnsPromise<void> |
static async simulatePrimeDropdown() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Simulates user selection on a PrimeNG dropdown/select | ||||||||||||
Presentation | ||||||||||||
Parameters
ReturnsPromise<void> |
static async simulatePrimeInput() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Simulates user input on a PrimeNG input field | ||||||||||||
Presentation | ||||||||||||
Parameters
ReturnsPromise<void> |
static async simulatePrimeToggle() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Simulates PrimeNG toggle switch (InputSwitch) | ||||||||||||
Presentation | ||||||||||||
Parameters
ReturnsPromise<void> |
static async updateFormValue() | |||||||||
|---|---|---|---|---|---|---|---|---|---|
Updates form value programmatically and waits for PrimeNG to synchronize Use this instead of directly calling fixture.componentRef.setInput('value', ...) | |||||||||
Presentation | |||||||||
Parameters
ReturnsPromise<void> |
static async waitForInit() | ||||||
|---|---|---|---|---|---|---|
Waits for the PrimeNG dynamic form to initialize | ||||||
Presentation | ||||||
Parameters
ReturnsPromise<void> |