index.d.ts 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import * as _angular_cdk_testing from '@angular/cdk/testing';
  2. import { BaseHarnessFilters, ContentContainerComponentHarness, ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';
  3. import { D as DialogRole, g as MatDialog, i as MatDialogConfig, M as MatDialogRef } from '../../dialog.d-B5HZULyo.js';
  4. import { ComponentType } from '@angular/cdk/overlay';
  5. import { OnDestroy } from '@angular/core';
  6. import '@angular/cdk/bidi';
  7. import '@angular/cdk/a11y';
  8. import 'rxjs';
  9. import '@angular/cdk/dialog';
  10. import '@angular/cdk/portal';
  11. /** A set of criteria that can be used to filter a list of `MatDialogHarness` instances. */
  12. interface DialogHarnessFilters extends BaseHarnessFilters {
  13. }
  14. /** Selectors for different sections of the mat-dialog that can contain user content. */
  15. declare enum MatDialogSection {
  16. TITLE = ".mat-mdc-dialog-title",
  17. CONTENT = ".mat-mdc-dialog-content",
  18. ACTIONS = ".mat-mdc-dialog-actions"
  19. }
  20. /** Harness for interacting with a standard `MatDialog` in tests. */
  21. declare class MatDialogHarness extends ContentContainerComponentHarness<MatDialogSection | string> {
  22. /** The selector for the host element of a `MatDialog` instance. */
  23. static hostSelector: string;
  24. /**
  25. * Gets a `HarnessPredicate` that can be used to search for a dialog with specific attributes.
  26. * @param options Options for filtering which dialog instances are considered a match.
  27. * @return a `HarnessPredicate` configured with the given options.
  28. */
  29. static with<T extends MatDialogHarness>(this: ComponentHarnessConstructor<T>, options?: DialogHarnessFilters): HarnessPredicate<T>;
  30. protected _title: () => Promise<_angular_cdk_testing.TestElement | null>;
  31. protected _content: () => Promise<_angular_cdk_testing.TestElement | null>;
  32. protected _actions: () => Promise<_angular_cdk_testing.TestElement | null>;
  33. /** Gets the id of the dialog. */
  34. getId(): Promise<string | null>;
  35. /** Gets the role of the dialog. */
  36. getRole(): Promise<DialogRole | null>;
  37. /** Gets the value of the dialog's "aria-label" attribute. */
  38. getAriaLabel(): Promise<string | null>;
  39. /** Gets the value of the dialog's "aria-labelledby" attribute. */
  40. getAriaLabelledby(): Promise<string | null>;
  41. /** Gets the value of the dialog's "aria-describedby" attribute. */
  42. getAriaDescribedby(): Promise<string | null>;
  43. /**
  44. * Closes the dialog by pressing escape.
  45. *
  46. * Note: this method does nothing if `disableClose` has been set to `true` for the dialog.
  47. */
  48. close(): Promise<void>;
  49. /** Gets the dialog's text. */
  50. getText(): Promise<string>;
  51. /** Gets the dialog's title text. This only works if the dialog is using mat-dialog-title. */
  52. getTitleText(): Promise<string>;
  53. /** Gets the dialog's content text. This only works if the dialog is using mat-dialog-content. */
  54. getContentText(): Promise<string>;
  55. /** Gets the dialog's actions text. This only works if the dialog is using mat-dialog-actions. */
  56. getActionsText(): Promise<string>;
  57. }
  58. /** Test component that immediately opens a dialog when bootstrapped. */
  59. declare class MatTestDialogOpener<T = unknown, R = unknown> implements OnDestroy {
  60. dialog: MatDialog;
  61. /** Component that should be opened with the MatDialog `open` method. */
  62. protected static component: ComponentType<unknown> | undefined;
  63. /** Config that should be provided to the MatDialog `open` method. */
  64. protected static config: MatDialogConfig | undefined;
  65. /** MatDialogRef returned from the MatDialog `open` method. */
  66. dialogRef: MatDialogRef<T, R>;
  67. /** Data passed to the `MatDialog` close method. */
  68. closedResult: R | undefined;
  69. private readonly _afterClosedSubscription;
  70. private readonly _ngZone;
  71. /** Static method that prepares this class to open the provided component. */
  72. static withComponent<T = unknown, R = unknown>(component: ComponentType<T>, config?: MatDialogConfig): ComponentType<MatTestDialogOpener<T, R>>;
  73. constructor(...args: unknown[]);
  74. ngOnDestroy(): void;
  75. }
  76. declare class MatTestDialogOpenerModule {
  77. }
  78. export { MatDialogHarness, MatDialogSection, MatTestDialogOpener, MatTestDialogOpenerModule };
  79. export type { DialogHarnessFilters };