input-harness.d-8fkAAbu2.d.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { BaseHarnessFilters, HarnessPredicate } from '@angular/cdk/testing';
  2. import { MatFormFieldControlHarness } from './form-field/testing/control/index.js';
  3. /** A set of criteria that can be used to filter a list of `MatInputHarness` instances. */
  4. interface InputHarnessFilters extends BaseHarnessFilters {
  5. /** Filters based on the value of the input. */
  6. value?: string | RegExp;
  7. /** Filters based on the placeholder text of the input. */
  8. placeholder?: string | RegExp;
  9. }
  10. /** Harness for interacting with a standard Material inputs in tests. */
  11. declare class MatInputHarness extends MatFormFieldControlHarness {
  12. static hostSelector: string;
  13. /**
  14. * Gets a `HarnessPredicate` that can be used to search for a `MatInputHarness` that meets
  15. * certain criteria.
  16. * @param options Options for filtering which input instances are considered a match.
  17. * @return a `HarnessPredicate` configured with the given options.
  18. */
  19. static with(options?: InputHarnessFilters): HarnessPredicate<MatInputHarness>;
  20. /** Whether the input is disabled. */
  21. isDisabled(): Promise<boolean>;
  22. /** Whether the input is required. */
  23. isRequired(): Promise<boolean>;
  24. /** Whether the input is readonly. */
  25. isReadonly(): Promise<boolean>;
  26. /** Gets the value of the input. */
  27. getValue(): Promise<string>;
  28. /** Gets the name of the input. */
  29. getName(): Promise<string>;
  30. /**
  31. * Gets the type of the input. Returns "textarea" if the input is
  32. * a textarea.
  33. */
  34. getType(): Promise<string>;
  35. /** Gets the placeholder of the input. */
  36. getPlaceholder(): Promise<string>;
  37. /** Gets the id of the input. */
  38. getId(): Promise<string>;
  39. /**
  40. * Focuses the input and returns a promise that indicates when the
  41. * action is complete.
  42. */
  43. focus(): Promise<void>;
  44. /**
  45. * Blurs the input and returns a promise that indicates when the
  46. * action is complete.
  47. */
  48. blur(): Promise<void>;
  49. /** Whether the input is focused. */
  50. isFocused(): Promise<boolean>;
  51. /**
  52. * Sets the value of the input. The value will be set by simulating
  53. * keypresses that correspond to the given value.
  54. */
  55. setValue(newValue: string): Promise<void>;
  56. }
  57. export { MatInputHarness as M };
  58. export type { InputHarnessFilters as I };