index.d.ts 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { BaseHarnessFilters, ContentContainerComponentHarness, HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
  2. /** A set of criteria that can be used to filter a list of `MatGridListHarness` instances. */
  3. interface GridListHarnessFilters extends BaseHarnessFilters {
  4. }
  5. /** A set of criteria that can be used to filter a list of `MatTileHarness` instances. */
  6. interface GridTileHarnessFilters extends BaseHarnessFilters {
  7. /** Text the grid-tile header should match. */
  8. headerText?: string | RegExp;
  9. /** Text the grid-tile footer should match. */
  10. footerText?: string | RegExp;
  11. }
  12. /** Selectors for the various `mat-grid-tile` sections that may contain user content. */
  13. declare enum MatGridTileSection {
  14. HEADER = ".mat-grid-tile-header",
  15. FOOTER = ".mat-grid-tile-footer"
  16. }
  17. /** Harness for interacting with a standard `MatGridTitle` in tests. */
  18. declare class MatGridTileHarness extends ContentContainerComponentHarness<MatGridTileSection> {
  19. /** The selector for the host element of a `MatGridTile` instance. */
  20. static hostSelector: string;
  21. /**
  22. * Gets a `HarnessPredicate` that can be used to search for a `MatGridTileHarness`
  23. * that meets certain criteria.
  24. * @param options Options for filtering which dialog instances are considered a match.
  25. * @return a `HarnessPredicate` configured with the given options.
  26. */
  27. static with(options?: GridTileHarnessFilters): HarnessPredicate<MatGridTileHarness>;
  28. private _header;
  29. private _footer;
  30. private _avatar;
  31. /** Gets the amount of rows that the grid-tile takes up. */
  32. getRowspan(): Promise<number>;
  33. /** Gets the amount of columns that the grid-tile takes up. */
  34. getColspan(): Promise<number>;
  35. /** Whether the grid-tile has a header. */
  36. hasHeader(): Promise<boolean>;
  37. /** Whether the grid-tile has a footer. */
  38. hasFooter(): Promise<boolean>;
  39. /** Whether the grid-tile has an avatar. */
  40. hasAvatar(): Promise<boolean>;
  41. /** Gets the text of the header if present. */
  42. getHeaderText(): Promise<string | null>;
  43. /** Gets the text of the footer if present. */
  44. getFooterText(): Promise<string | null>;
  45. }
  46. /** Harness for interacting with a standard `MatGridList` in tests. */
  47. declare class MatGridListHarness extends ComponentHarness {
  48. /** The selector for the host element of a `MatGridList` instance. */
  49. static hostSelector: string;
  50. /**
  51. * Gets a `HarnessPredicate` that can be used to search for a `MatGridListHarness`
  52. * that meets certain criteria.
  53. * @param options Options for filtering which dialog instances are considered a match.
  54. * @return a `HarnessPredicate` configured with the given options.
  55. */
  56. static with(options?: GridListHarnessFilters): HarnessPredicate<MatGridListHarness>;
  57. /**
  58. * Tile coordinator that is used by the "MatGridList" for computing
  59. * positions of tiles. We leverage the coordinator to provide an API
  60. * for retrieving tiles based on visual tile positions.
  61. */
  62. private _tileCoordinator;
  63. /** Gets all tiles of the grid-list. */
  64. getTiles(filters?: GridTileHarnessFilters): Promise<MatGridTileHarness[]>;
  65. /** Gets the amount of columns of the grid-list. */
  66. getColumns(): Promise<number>;
  67. /**
  68. * Gets a tile of the grid-list that is located at the given location.
  69. * @param row Zero-based row index.
  70. * @param column Zero-based column index.
  71. */
  72. getTileAtPosition({ row, column, }: {
  73. row: number;
  74. column: number;
  75. }): Promise<MatGridTileHarness>;
  76. }
  77. export { MatGridListHarness, MatGridTileHarness, MatGridTileSection };
  78. export type { GridListHarnessFilters, GridTileHarnessFilters };