index.d.ts 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import { BaseHarnessFilters, HarnessPredicate, ContentContainerComponentHarness } from '@angular/cdk/testing';
  2. /** A set of criteria that can be used to filter a list of `MatDrawerHarness` instances. */
  3. interface DrawerHarnessFilters extends BaseHarnessFilters {
  4. /** Only find instances whose side is the given value. */
  5. position?: 'start' | 'end';
  6. }
  7. /** A set of criteria that can be used to filter a list of `MatDrawerContainerHarness` instances. */
  8. interface DrawerContainerHarnessFilters extends BaseHarnessFilters {
  9. }
  10. /** A set of criteria that can be used to filter a list of `MatDrawerContentHarness` instances. */
  11. interface DrawerContentHarnessFilters extends BaseHarnessFilters {
  12. }
  13. /**
  14. * Base class for the drawer harness functionality.
  15. * @docs-private
  16. */
  17. declare class MatDrawerHarnessBase extends ContentContainerComponentHarness<string> {
  18. /** Whether the drawer is open. */
  19. isOpen(): Promise<boolean>;
  20. /** Gets the position of the drawer inside its container. */
  21. getPosition(): Promise<'start' | 'end'>;
  22. /** Gets the mode that the drawer is in. */
  23. getMode(): Promise<'over' | 'push' | 'side'>;
  24. }
  25. /** Harness for interacting with a standard mat-drawer in tests. */
  26. declare class MatDrawerHarness extends MatDrawerHarnessBase {
  27. /** The selector for the host element of a `MatDrawer` instance. */
  28. static hostSelector: string;
  29. /**
  30. * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerHarness` that meets
  31. * certain criteria.
  32. * @param options Options for filtering which drawer instances are considered a match.
  33. * @return a `HarnessPredicate` configured with the given options.
  34. */
  35. static with(options?: DrawerHarnessFilters): HarnessPredicate<MatDrawerHarness>;
  36. }
  37. /** Harness for interacting with a standard mat-drawer-content in tests. */
  38. declare class MatDrawerContentHarness extends ContentContainerComponentHarness<string> {
  39. /** The selector for the host element of a `MatDrawerContent` instance. */
  40. static hostSelector: string;
  41. /**
  42. * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContentHarness` that
  43. * meets certain criteria.
  44. * @param options Options for filtering which drawer content instances are considered a match.
  45. * @return a `HarnessPredicate` configured with the given options.
  46. */
  47. static with(options?: DrawerContentHarnessFilters): HarnessPredicate<MatDrawerContentHarness>;
  48. }
  49. /** Harness for interacting with a standard mat-drawer-container in tests. */
  50. declare class MatDrawerContainerHarness extends ContentContainerComponentHarness<string> {
  51. /** The selector for the host element of a `MatDrawerContainer` instance. */
  52. static hostSelector: string;
  53. /**
  54. * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContainerHarness` that
  55. * meets certain criteria.
  56. * @param options Options for filtering which container instances are considered a match.
  57. * @return a `HarnessPredicate` configured with the given options.
  58. */
  59. static with(options?: DrawerContainerHarnessFilters): HarnessPredicate<MatDrawerContainerHarness>;
  60. /**
  61. * Gets drawers that match particular criteria within the container.
  62. * @param filter Optionally filters which chips are included.
  63. */
  64. getDrawers(filter?: DrawerHarnessFilters): Promise<MatDrawerHarness[]>;
  65. /** Gets the element that has the container's content. */
  66. getContent(): Promise<MatDrawerContentHarness>;
  67. }
  68. /** Harness for interacting with a standard mat-sidenav-content in tests. */
  69. declare class MatSidenavContentHarness extends ContentContainerComponentHarness<string> {
  70. /** The selector for the host element of a `MatSidenavContent` instance. */
  71. static hostSelector: string;
  72. /**
  73. * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContentHarness` that
  74. * meets certain criteria.
  75. * @param options Options for filtering which sidenav content instances are considered a match.
  76. * @return a `HarnessPredicate` configured with the given options.
  77. */
  78. static with(options?: DrawerContentHarnessFilters): HarnessPredicate<MatSidenavContentHarness>;
  79. }
  80. /** Harness for interacting with a standard mat-sidenav in tests. */
  81. declare class MatSidenavHarness extends MatDrawerHarnessBase {
  82. /** The selector for the host element of a `MatSidenav` instance. */
  83. static hostSelector: string;
  84. /**
  85. * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavHarness` that meets
  86. * certain criteria.
  87. * @param options Options for filtering which sidenav instances are considered a match.
  88. * @return a `HarnessPredicate` configured with the given options.
  89. */
  90. static with(options?: DrawerHarnessFilters): HarnessPredicate<MatSidenavHarness>;
  91. /** Whether the sidenav is fixed in the viewport. */
  92. isFixedInViewport(): Promise<boolean>;
  93. }
  94. /** Harness for interacting with a standard mat-sidenav-container in tests. */
  95. declare class MatSidenavContainerHarness extends ContentContainerComponentHarness<string> {
  96. /** The selector for the host element of a `MatSidenavContainer` instance. */
  97. static hostSelector: string;
  98. /**
  99. * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContainerHarness` that
  100. * meets certain criteria.
  101. * @param options Options for filtering which container instances are considered a match.
  102. * @return a `HarnessPredicate` configured with the given options.
  103. */
  104. static with(options?: DrawerContainerHarnessFilters): HarnessPredicate<MatSidenavContainerHarness>;
  105. /**
  106. * Gets sidenavs that match particular criteria within the container.
  107. * @param filter Optionally filters which chips are included.
  108. */
  109. getSidenavs(filter?: DrawerHarnessFilters): Promise<MatSidenavHarness[]>;
  110. /** Gets the element that has the container's content. */
  111. getContent(): Promise<MatSidenavContentHarness>;
  112. }
  113. export { MatDrawerContainerHarness, MatDrawerContentHarness, MatDrawerHarness, MatSidenavContainerHarness, MatSidenavContentHarness, MatSidenavHarness };
  114. export type { DrawerContainerHarnessFilters, DrawerContentHarnessFilters, DrawerHarnessFilters };