index.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { BaseHarnessFilters, ContentContainerComponentHarness, ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';
  2. /** A set of criteria that can be used to filter a list of `MatCardHarness` instances. */
  3. interface CardHarnessFilters extends BaseHarnessFilters {
  4. /** Only find instances whose text matches the given value. */
  5. text?: string | RegExp;
  6. /** Only find instances whose title matches the given value. */
  7. title?: string | RegExp;
  8. /** Only find instances whose subtitle matches the given value. */
  9. subtitle?: string | RegExp;
  10. }
  11. /** Selectors for different sections of the mat-card that can container user content. */
  12. declare enum MatCardSection {
  13. HEADER = ".mat-mdc-card-header",
  14. CONTENT = ".mat-mdc-card-content",
  15. ACTIONS = ".mat-mdc-card-actions",
  16. FOOTER = ".mat-mdc-card-footer"
  17. }
  18. /** Harness for interacting with a mat-card in tests. */
  19. declare class MatCardHarness extends ContentContainerComponentHarness<MatCardSection> {
  20. /** The selector for the host element of a `MatCard` instance. */
  21. static hostSelector: string;
  22. /**
  23. * Gets a `HarnessPredicate` that can be used to search for a card with specific attributes.
  24. * @param options Options for filtering which card instances are considered a match.
  25. * @return a `HarnessPredicate` configured with the given options.
  26. */
  27. static with<T extends MatCardHarness>(this: ComponentHarnessConstructor<T>, options?: CardHarnessFilters): HarnessPredicate<T>;
  28. private _title;
  29. private _subtitle;
  30. /** Gets all of the card's content as text. */
  31. getText(): Promise<string>;
  32. /** Gets the cards's title text. */
  33. getTitleText(): Promise<string>;
  34. /** Gets the cards's subtitle text. */
  35. getSubtitleText(): Promise<string>;
  36. }
  37. export { MatCardHarness, MatCardSection };
  38. export type { CardHarnessFilters };