index.d.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. export { I as InputHarnessFilters, M as MatInputHarness } from '../../input-harness.d-8fkAAbu2.js';
  2. import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
  3. import { MatFormFieldControlHarness } from '../../form-field/testing/control/index.js';
  4. /** A set of criteria that can be used to filter a list of `MatNativeSelectHarness` instances. */
  5. interface NativeSelectHarnessFilters extends BaseHarnessFilters {
  6. }
  7. /** A set of criteria that can be used to filter a list of `MatNativeOptionHarness` instances. */
  8. interface NativeOptionHarnessFilters extends BaseHarnessFilters {
  9. text?: string | RegExp;
  10. index?: number;
  11. isSelected?: boolean;
  12. }
  13. /** Harness for interacting with a native `option` in tests. */
  14. declare class MatNativeOptionHarness extends ComponentHarness {
  15. /** Selector used to locate option instances. */
  16. static hostSelector: string;
  17. /**
  18. * Gets a `HarnessPredicate` that can be used to search for a `MatNativeOptionHarness` that meets
  19. * certain criteria.
  20. * @param options Options for filtering which option instances are considered a match.
  21. * @return a `HarnessPredicate` configured with the given options.
  22. */
  23. static with(options?: NativeOptionHarnessFilters): HarnessPredicate<MatNativeOptionHarness>;
  24. /** Gets the option's label text. */
  25. getText(): Promise<string>;
  26. /** Index of the option within the native `select` element. */
  27. getIndex(): Promise<number>;
  28. /** Gets whether the option is disabled. */
  29. isDisabled(): Promise<boolean>;
  30. /** Gets whether the option is selected. */
  31. isSelected(): Promise<boolean>;
  32. }
  33. /** Harness for interacting with a native `select` in tests. */
  34. declare class MatNativeSelectHarness extends MatFormFieldControlHarness {
  35. static hostSelector: string;
  36. /**
  37. * Gets a `HarnessPredicate` that can be used to search for a `MatNativeSelectHarness` that meets
  38. * certain criteria.
  39. * @param options Options for filtering which select instances are considered a match.
  40. * @return a `HarnessPredicate` configured with the given options.
  41. */
  42. static with(options?: NativeSelectHarnessFilters): HarnessPredicate<MatNativeSelectHarness>;
  43. /** Gets a boolean promise indicating if the select is disabled. */
  44. isDisabled(): Promise<boolean>;
  45. /** Gets a boolean promise indicating if the select is required. */
  46. isRequired(): Promise<boolean>;
  47. /** Gets a boolean promise indicating if the select is in multi-selection mode. */
  48. isMultiple(): Promise<boolean>;
  49. /** Gets the name of the select. */
  50. getName(): Promise<string>;
  51. /** Gets the id of the select. */
  52. getId(): Promise<string>;
  53. /** Focuses the select and returns a void promise that indicates when the action is complete. */
  54. focus(): Promise<void>;
  55. /** Blurs the select and returns a void promise that indicates when the action is complete. */
  56. blur(): Promise<void>;
  57. /** Whether the select is focused. */
  58. isFocused(): Promise<boolean>;
  59. /** Gets the options inside the select panel. */
  60. getOptions(filter?: NativeOptionHarnessFilters): Promise<MatNativeOptionHarness[]>;
  61. /**
  62. * Selects the options that match the passed-in filter. If the select is in multi-selection
  63. * mode all options will be clicked, otherwise the harness will pick the first matching option.
  64. */
  65. selectOptions(filter?: NativeOptionHarnessFilters): Promise<void>;
  66. }
  67. export { MatNativeOptionHarness, MatNativeSelectHarness };
  68. export type { NativeOptionHarnessFilters, NativeSelectHarnessFilters };