index.d.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import { BaseHarnessFilters, ComponentHarness, ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';
  2. import { O as OptionHarnessFilters, M as MatOptionHarness } from '../../option-harness.d-IqsW95GR.js';
  3. /** A set of criteria that can be used to filter a list of `MatTimepickerHarness` instances. */
  4. interface TimepickerHarnessFilters extends BaseHarnessFilters {
  5. }
  6. /** A set of criteria that can be used to filter a list of timepicker input instances. */
  7. interface TimepickerInputHarnessFilters extends BaseHarnessFilters {
  8. /** Filters based on the value of the input. */
  9. value?: string | RegExp;
  10. /** Filters based on the placeholder text of the input. */
  11. placeholder?: string | RegExp;
  12. }
  13. /** A set of criteria that can be used to filter a list of timepicker toggle instances. */
  14. interface TimepickerToggleHarnessFilters extends BaseHarnessFilters {
  15. }
  16. declare class MatTimepickerHarness extends ComponentHarness {
  17. private _documentRootLocator;
  18. static hostSelector: string;
  19. /**
  20. * Gets a `HarnessPredicate` that can be used to search for a timepicker with specific
  21. * attributes.
  22. * @param options Options for filtering which timepicker instances are considered a match.
  23. * @return a `HarnessPredicate` configured with the given options.
  24. */
  25. static with<T extends MatTimepickerHarness>(this: ComponentHarnessConstructor<T>, options?: TimepickerHarnessFilters): HarnessPredicate<T>;
  26. /** Whether the timepicker is open. */
  27. isOpen(): Promise<boolean>;
  28. /** Gets the options inside the timepicker panel. */
  29. getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]>;
  30. /** Selects the first option matching the given filters. */
  31. selectOption(filters: OptionHarnessFilters): Promise<void>;
  32. /** Gets the selector that can be used to find the timepicker's panel. */
  33. protected _getPanelSelector(): Promise<string>;
  34. }
  35. /** Harness for interacting with a standard Material timepicker inputs in tests. */
  36. declare class MatTimepickerInputHarness extends ComponentHarness {
  37. private _documentRootLocator;
  38. static hostSelector: string;
  39. /**
  40. * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerInputHarness`
  41. * that meets certain criteria.
  42. * @param options Options for filtering which input instances are considered a match.
  43. * @return a `HarnessPredicate` configured with the given options.
  44. */
  45. static with<T extends MatTimepickerInputHarness>(this: ComponentHarnessConstructor<T>, options?: TimepickerInputHarnessFilters): HarnessPredicate<T>;
  46. /** Gets whether the timepicker associated with the input is open. */
  47. isTimepickerOpen(): Promise<boolean>;
  48. /** Opens the timepicker associated with the input and returns the timepicker instance. */
  49. openTimepicker(): Promise<MatTimepickerHarness>;
  50. /** Closes the timepicker associated with the input. */
  51. closeTimepicker(): Promise<void>;
  52. /**
  53. * Gets the `MatTimepickerHarness` that is associated with the input.
  54. * @param filter Optionally filters which timepicker is included.
  55. */
  56. getTimepicker(filter?: TimepickerHarnessFilters): Promise<MatTimepickerHarness>;
  57. /** Whether the input is disabled. */
  58. isDisabled(): Promise<boolean>;
  59. /** Whether the input is required. */
  60. isRequired(): Promise<boolean>;
  61. /** Gets the value of the input. */
  62. getValue(): Promise<string>;
  63. /**
  64. * Sets the value of the input. The value will be set by simulating
  65. * keypresses that correspond to the given value.
  66. */
  67. setValue(newValue: string): Promise<void>;
  68. /** Gets the placeholder of the input. */
  69. getPlaceholder(): Promise<string>;
  70. /**
  71. * Focuses the input and returns a promise that indicates when the
  72. * action is complete.
  73. */
  74. focus(): Promise<void>;
  75. /**
  76. * Blurs the input and returns a promise that indicates when the
  77. * action is complete.
  78. */
  79. blur(): Promise<void>;
  80. /** Whether the input is focused. */
  81. isFocused(): Promise<boolean>;
  82. }
  83. /** Harness for interacting with a standard Material timepicker toggle in tests. */
  84. declare class MatTimepickerToggleHarness extends ComponentHarness {
  85. static hostSelector: string;
  86. /** The clickable button inside the toggle. */
  87. private _button;
  88. /**
  89. * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerToggleHarness` that
  90. * meets certain criteria.
  91. * @param options Options for filtering which timepicker toggle instances are considered a match.
  92. * @return a `HarnessPredicate` configured with the given options.
  93. */
  94. static with(options?: TimepickerToggleHarnessFilters): HarnessPredicate<MatTimepickerToggleHarness>;
  95. /** Opens the timepicker associated with the toggle. */
  96. openTimepicker(): Promise<void>;
  97. /** Gets whether the timepicker associated with the toggle is open. */
  98. isTimepickerOpen(): Promise<boolean>;
  99. /** Whether the toggle is disabled. */
  100. isDisabled(): Promise<boolean>;
  101. }
  102. export { MatTimepickerHarness, MatTimepickerInputHarness, MatTimepickerToggleHarness };
  103. export type { TimepickerHarnessFilters, TimepickerInputHarnessFilters, TimepickerToggleHarnessFilters };