index.d.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. import { OptgroupHarnessFilters, MatOptgroupHarness } from '../../core/testing/index.js';
  4. /** A set of criteria that can be used to filter a list of `MatAutocompleteHarness` instances. */
  5. interface AutocompleteHarnessFilters extends BaseHarnessFilters {
  6. /** Only find instances whose associated input element matches the given value. */
  7. value?: string | RegExp;
  8. /** Only find instances which match the given disabled state. */
  9. disabled?: boolean;
  10. }
  11. declare class MatAutocompleteHarness extends ComponentHarness {
  12. private _documentRootLocator;
  13. /** The selector for the host element of a `MatAutocomplete` instance. */
  14. static hostSelector: string;
  15. /**
  16. * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific
  17. * attributes.
  18. * @param options Options for filtering which autocomplete instances are considered a match.
  19. * @return a `HarnessPredicate` configured with the given options.
  20. */
  21. static with<T extends MatAutocompleteHarness>(this: ComponentHarnessConstructor<T>, options?: AutocompleteHarnessFilters): HarnessPredicate<T>;
  22. /** Gets the value of the autocomplete input. */
  23. getValue(): Promise<string>;
  24. /** Whether the autocomplete input is disabled. */
  25. isDisabled(): Promise<boolean>;
  26. /** Focuses the autocomplete input. */
  27. focus(): Promise<void>;
  28. /** Blurs the autocomplete input. */
  29. blur(): Promise<void>;
  30. /** Whether the autocomplete input is focused. */
  31. isFocused(): Promise<boolean>;
  32. /** Enters text into the autocomplete. */
  33. enterText(value: string): Promise<void>;
  34. /** Clears the input value. */
  35. clear(): Promise<void>;
  36. /** Gets the options inside the autocomplete panel. */
  37. getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]>;
  38. /** Gets the option groups inside the autocomplete panel. */
  39. getOptionGroups(filters?: Omit<OptgroupHarnessFilters, 'ancestor'>): Promise<MatOptgroupHarness[]>;
  40. /** Selects the first option matching the given filters. */
  41. selectOption(filters: OptionHarnessFilters): Promise<void>;
  42. /** Whether the autocomplete is open. */
  43. isOpen(): Promise<boolean>;
  44. /** Gets the panel associated with this autocomplete trigger. */
  45. private _getPanel;
  46. /** Gets the selector that can be used to find the autocomplete trigger's panel. */
  47. protected _getPanelSelector(): Promise<string>;
  48. }
  49. export { MatAutocompleteHarness };
  50. export type { AutocompleteHarnessFilters };