index.d.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { BaseHarnessFilters, ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
  2. import { AriaLivePoliteness } from '@angular/cdk/a11y';
  3. /** A set of criteria that can be used to filter a list of `MatSnackBarHarness` instances. */
  4. interface SnackBarHarnessFilters extends BaseHarnessFilters {
  5. }
  6. /** Harness for interacting with a mat-snack-bar in tests. */
  7. declare class MatSnackBarHarness extends ContentContainerComponentHarness<string> {
  8. /** The selector for the host element of a `MatSnackBar` instance. */
  9. static hostSelector: string;
  10. private _messageSelector;
  11. private _actionButtonSelector;
  12. private _snackBarLiveRegion;
  13. /**
  14. * Gets a `HarnessPredicate` that can be used to search for a `MatSnackBarHarness` that meets
  15. * certain criteria.
  16. * @param options Options for filtering which snack bar instances are considered a match.
  17. * @return a `HarnessPredicate` configured with the given options.
  18. */
  19. static with(options?: SnackBarHarnessFilters): HarnessPredicate<MatSnackBarHarness>;
  20. /**
  21. * Gets the role of the snack-bar. The role of a snack-bar is determined based
  22. * on the ARIA politeness specified in the snack-bar config.
  23. * @deprecated Use `getAriaLive` instead.
  24. * @breaking-change 13.0.0
  25. */
  26. getRole(): Promise<'alert' | 'status' | null>;
  27. /**
  28. * Gets the aria-live of the snack-bar's live region. The aria-live of a snack-bar is
  29. * determined based on the ARIA politeness specified in the snack-bar config.
  30. */
  31. getAriaLive(): Promise<AriaLivePoliteness>;
  32. /**
  33. * Whether the snack-bar has an action. Method cannot be used for snack-bar's with custom content.
  34. */
  35. hasAction(): Promise<boolean>;
  36. /**
  37. * Gets the description of the snack-bar. Method cannot be used for snack-bar's without action or
  38. * with custom content.
  39. */
  40. getActionDescription(): Promise<string>;
  41. /**
  42. * Dismisses the snack-bar by clicking the action button. Method cannot be used for snack-bar's
  43. * without action or with custom content.
  44. */
  45. dismissWithAction(): Promise<void>;
  46. /**
  47. * Gets the message of the snack-bar. Method cannot be used for snack-bar's with custom content.
  48. */
  49. getMessage(): Promise<string>;
  50. /** Gets whether the snack-bar has been dismissed. */
  51. isDismissed(): Promise<boolean>;
  52. /**
  53. * Asserts that the current snack-bar has an action defined. Otherwise the
  54. * promise will reject.
  55. */
  56. private _assertHasAction;
  57. /** Gets the simple snack bar action button. */
  58. private _getActionButton;
  59. }
  60. export { MatSnackBarHarness };
  61. export type { SnackBarHarnessFilters };