import { AsyncFactoryFn } from '@angular/cdk/testing'; import { BaseHarnessFilters } from '@angular/cdk/testing'; import { ComponentHarness } from '@angular/cdk/testing'; import { ComponentHarnessConstructor } from '@angular/cdk/testing'; import { HarnessPredicate } from '@angular/cdk/testing'; import { MatDatepickerInputHarness } from '@angular/material/datepicker/testing'; import { MatDateRangeInputHarness } from '@angular/material/datepicker/testing'; import { MatFormFieldControlHarness } from '@angular/material/form-field/testing/control'; import { MatInputHarness } from '@angular/material/input/testing'; import { MatSelectHarness } from '@angular/material/select/testing'; import { TestElement } from '@angular/cdk/testing'; declare interface ErrorBase extends ComponentHarness { getText(): Promise; } /** A set of criteria that can be used to filter a list of error harness instances. */ export declare interface ErrorHarnessFilters extends BaseHarnessFilters { /** Only find instances whose text matches the given value. */ text?: string | RegExp; } /** Possible harnesses of controls which can be bound to a form-field. */ export declare type FormFieldControlHarness = MatInputHarness | MatSelectHarness | MatDatepickerInputHarness | MatDateRangeInputHarness; /** A set of criteria that can be used to filter a list of `MatFormFieldHarness` instances. */ export declare interface FormFieldHarnessFilters extends BaseHarnessFilters { /** Filters based on the text of the form field's floating label. */ floatingLabelText?: string | RegExp; /** Filters based on whether the form field has error messages. */ hasErrors?: boolean; /** Filters based on whether the form field value is valid. */ isValid?: boolean; } /** Harness for interacting with an MDC-based `mat-error` in tests. */ export declare class MatErrorHarness extends _MatErrorHarnessBase { static hostSelector: string; /** * Gets a `HarnessPredicate` that can be used to search for an error with specific * attributes. * @param options Options for filtering which error instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(this: ComponentHarnessConstructor, options?: ErrorHarnessFilters): HarnessPredicate; } export declare abstract class _MatErrorHarnessBase extends ComponentHarness { /** Gets a promise for the error's label text. */ getText(): Promise; protected static _getErrorPredicate(type: ComponentHarnessConstructor, options: ErrorHarnessFilters): HarnessPredicate; } export { MatFormFieldControlHarness } /** Harness for interacting with a MDC-based form-field's in tests. */ export declare class MatFormFieldHarness extends _MatFormFieldHarnessBase { static hostSelector: string; /** * Gets a `HarnessPredicate` that can be used to search for a form field with specific * attributes. * @param options Options for filtering which form field instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(this: ComponentHarnessConstructor, options?: FormFieldHarnessFilters): HarnessPredicate; protected _prefixContainer: AsyncFactoryFn; protected _suffixContainer: AsyncFactoryFn; protected _label: AsyncFactoryFn; protected _hints: AsyncFactoryFn; protected _inputControl: AsyncFactoryFn; protected _selectControl: AsyncFactoryFn; protected _datepickerInputControl: AsyncFactoryFn; protected _dateRangeInputControl: AsyncFactoryFn; protected _errorHarness: typeof MatErrorHarness; private _mdcTextField; /** Gets the appearance of the form-field. */ getAppearance(): Promise<'fill' | 'outline'>; /** Whether the form-field has a label. */ hasLabel(): Promise; /** Whether the label is currently floating. */ isLabelFloating(): Promise; } export declare abstract class _MatFormFieldHarnessBase & { with: (options?: ErrorHarnessFilters) => HarnessPredicate; }> extends ComponentHarness { protected abstract _prefixContainer: AsyncFactoryFn; protected abstract _suffixContainer: AsyncFactoryFn; protected abstract _label: AsyncFactoryFn; protected abstract _hints: AsyncFactoryFn; protected abstract _inputControl: AsyncFactoryFn; protected abstract _selectControl: AsyncFactoryFn; protected abstract _datepickerInputControl: AsyncFactoryFn; protected abstract _dateRangeInputControl: AsyncFactoryFn; protected abstract _errorHarness: ErrorType; /** Gets the appearance of the form-field. */ abstract getAppearance(): Promise; /** Whether the label is currently floating. */ abstract isLabelFloating(): Promise; /** Whether the form-field has a label. */ abstract hasLabel(): Promise; /** Gets the label of the form-field. */ getLabel(): Promise; /** Whether the form-field has errors. */ hasErrors(): Promise; /** Whether the form-field is disabled. */ isDisabled(): Promise; /** Whether the form-field is currently autofilled. */ isAutofilled(): Promise; /** * Gets the harness of the control that is bound to the form-field. Only * default controls such as "MatInputHarness" and "MatSelectHarness" are * supported. */ getControl(): Promise; /** * Gets the harness of the control that is bound to the form-field. Searches * for a control that matches the specified harness type. */ getControl(type: ComponentHarnessConstructor): Promise; /** * Gets the harness of the control that is bound to the form-field. Searches * for a control that matches the specified harness predicate. */ getControl(type: HarnessPredicate): Promise; /** Gets the theme color of the form-field. */ getThemeColor(): Promise<'primary' | 'accent' | 'warn'>; /** Gets error messages which are currently displayed in the form-field. */ getTextErrors(): Promise; /** Gets all of the error harnesses in the form field. */ getErrors(filter?: ErrorHarnessFilters): Promise; /** Gets hint messages which are currently displayed in the form-field. */ getTextHints(): Promise; /** Gets the text inside the prefix element. */ getPrefixText(): Promise; /** Gets the text inside the suffix element. */ getSuffixText(): Promise; /** * Whether the form control has been touched. Returns "null" * if no form control is set up. */ isControlTouched(): Promise; /** * Whether the form control is dirty. Returns "null" * if no form control is set up. */ isControlDirty(): Promise; /** * Whether the form control is valid. Returns "null" * if no form control is set up. */ isControlValid(): Promise; /** * Whether the form control is pending validation. Returns "null" * if no form control is set up. */ isControlPending(): Promise; /** Checks whether the form-field control has set up a form control. */ private _hasFormControl; } export { }