index.d.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
  2. import * as i0 from '@angular/core';
  3. import { OnDestroy } from '@angular/core';
  4. import { Observable } from 'rxjs';
  5. import { M as MatIconRegistry } from '../../icon-registry.d-BVwP8t9_.js';
  6. import '@angular/common/http';
  7. import '@angular/platform-browser';
  8. /** Possible types of icons. */
  9. declare enum IconType {
  10. SVG = 0,
  11. FONT = 1
  12. }
  13. /** A set of criteria that can be used to filter a list of `MatIconHarness` instances. */
  14. interface IconHarnessFilters extends BaseHarnessFilters {
  15. /** Filters based on the typef of the icon. */
  16. type?: IconType;
  17. /** Filters based on the name of the icon. */
  18. name?: string | RegExp;
  19. /** Filters based on the namespace of the icon. */
  20. namespace?: string | null | RegExp;
  21. }
  22. /** Harness for interacting with a standard mat-icon in tests. */
  23. declare class MatIconHarness extends ComponentHarness {
  24. /** The selector for the host element of a `MatIcon` instance. */
  25. static hostSelector: string;
  26. /**
  27. * Gets a `HarnessPredicate` that can be used to search for a `MatIconHarness` that meets
  28. * certain criteria.
  29. * @param options Options for filtering which icon instances are considered a match.
  30. * @return a `HarnessPredicate` configured with the given options.
  31. */
  32. static with(options?: IconHarnessFilters): HarnessPredicate<MatIconHarness>;
  33. /** Gets the type of the icon. */
  34. getType(): Promise<IconType>;
  35. /** Gets the name of the icon. */
  36. getName(): Promise<string | null>;
  37. /** Gets the namespace of the icon. */
  38. getNamespace(): Promise<string | null>;
  39. /** Gets whether the icon is inline. */
  40. isInline(): Promise<boolean>;
  41. }
  42. type PublicApi<T> = {
  43. [K in keyof T]: T[K] extends (...x: any[]) => T ? (...x: any[]) => PublicApi<T> : T[K];
  44. };
  45. /**
  46. * A null icon registry that must be imported to allow disabling of custom
  47. * icons.
  48. */
  49. declare class FakeMatIconRegistry implements PublicApi<MatIconRegistry>, OnDestroy {
  50. addSvgIcon(): this;
  51. addSvgIconLiteral(): this;
  52. addSvgIconInNamespace(): this;
  53. addSvgIconLiteralInNamespace(): this;
  54. addSvgIconSet(): this;
  55. addSvgIconSetLiteral(): this;
  56. addSvgIconSetInNamespace(): this;
  57. addSvgIconSetLiteralInNamespace(): this;
  58. registerFontClassAlias(): this;
  59. classNameForFontAlias(alias: string): string;
  60. getDefaultFontSetClass(): string[];
  61. getSvgIconFromUrl(): Observable<SVGElement>;
  62. getNamedSvgIcon(): Observable<SVGElement>;
  63. setDefaultFontSetClass(): this;
  64. addSvgIconResolver(): this;
  65. ngOnDestroy(): void;
  66. private _generateEmptySvg;
  67. static ɵfac: i0.ɵɵFactoryDeclaration<FakeMatIconRegistry, never>;
  68. static ɵprov: i0.ɵɵInjectableDeclaration<FakeMatIconRegistry>;
  69. }
  70. /** Import this module in tests to install the null icon registry. */
  71. declare class MatIconTestingModule {
  72. static ɵfac: i0.ɵɵFactoryDeclaration<MatIconTestingModule, never>;
  73. static ɵmod: i0.ɵɵNgModuleDeclaration<MatIconTestingModule, never, never, never>;
  74. static ɵinj: i0.ɵɵInjectorDeclaration<MatIconTestingModule>;
  75. }
  76. export { FakeMatIconRegistry, IconType, MatIconHarness, MatIconTestingModule };
  77. export type { IconHarnessFilters };