{"version":3,"file":"ngx-com-components-alert-testing.mjs","sources":["../../../projects/com/components/alert/testing/alert.harness.ts","../../../projects/com/components/alert/testing/index.ts","../../../projects/com/components/alert/testing/ngx-com-components-alert-testing.ts"],"sourcesContent":["import {\n  ComponentHarness,\n  HarnessPredicate,\n} from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Harness filters for ComAlertHarness. */\nexport interface ComAlertHarnessFilters extends BaseHarnessFilters {\n  /** Filter by the alert's title text. */\n  title?: string | RegExp;\n}\n\n/**\n * Harness for interacting with a ComAlert in tests.\n */\nexport class ComAlertHarness extends ComponentHarness {\n  static hostSelector = 'com-alert';\n\n  private readonly alertEl = this.locatorForOptional('[role=\"alert\"], [role=\"status\"]');\n  private readonly titleEl = this.locatorForOptional('[comAlertTitle]');\n  private readonly descriptionEl = this.locatorForOptional('[comAlertDescription]');\n  private readonly dismissButton = this.locatorForOptional('button[aria-label=\"Dismiss\"]');\n\n  /**\n   * Gets a HarnessPredicate for matching alerts.\n   * @param options Filter options.\n   */\n  static with(options: ComAlertHarnessFilters = {}): HarnessPredicate<ComAlertHarness> {\n    return new HarnessPredicate(ComAlertHarness, options)\n      .addOption('title', options.title, async (harness, title) => {\n        const text = await harness.getTitle();\n        if (text === null) return false;\n        return HarnessPredicate.stringMatches(text, title);\n      });\n  }\n\n  /** Gets the alert's title text, or null if no title is projected. */\n  async getTitle(): Promise<string | null> {\n    const el = await this.titleEl();\n    return el ? el.text() : null;\n  }\n\n  /** Gets the alert's description text, or null if no description is projected. */\n  async getDescription(): Promise<string | null> {\n    const el = await this.descriptionEl();\n    return el ? el.text() : null;\n  }\n\n  /** Gets the full text content of the alert element. */\n  async getText(): Promise<string> {\n    const el = await this.alertEl();\n    if (!el) {\n      throw Error('Cannot get text of a dismissed alert.');\n    }\n    return el.text();\n  }\n\n  /** Gets the role attribute of the alert element. */\n  async getRole(): Promise<string | null> {\n    const el = await this.alertEl();\n    return el ? el.getAttribute('role') : null;\n  }\n\n  /** Gets the aria-live attribute of the alert element. */\n  async getAriaLive(): Promise<string | null> {\n    const el = await this.alertEl();\n    return el ? el.getAttribute('aria-live') : null;\n  }\n\n  /** Whether the alert has a dismiss button. */\n  async isDismissible(): Promise<boolean> {\n    const el = await this.dismissButton();\n    return el !== null;\n  }\n\n  /** Clicks the dismiss button. Throws if the alert is not dismissible. */\n  async dismiss(): Promise<void> {\n    const el = await this.dismissButton();\n    if (!el) {\n      throw Error('Cannot dismiss an alert that is not dismissible.');\n    }\n    return el.click();\n  }\n\n  /** Whether the alert is currently visible (not dismissed). */\n  async isVisible(): Promise<boolean> {\n    const el = await this.alertEl();\n    return el !== null;\n  }\n}\n","// Testing utilities for the alert component\n\nexport { ComAlertHarness } from './alert.harness';\n\nexport type { ComAlertHarnessFilters } from './alert.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAYA;;AAEG;AACG,MAAO,eAAgB,SAAQ,gBAAgB,CAAA;AACnD,IAAA,OAAO,YAAY,GAAG,WAAW;AAEhB,IAAA,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,iCAAiC,CAAC;AACpE,IAAA,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC;AACpD,IAAA,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAAC;AAChE,IAAA,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,8BAA8B,CAAC;AAExF;;;AAGG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAkC,EAAE,EAAA;AAC9C,QAAA,OAAO,IAAI,gBAAgB,CAAC,eAAe,EAAE,OAAO;AACjD,aAAA,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,OAAO,EAAE,KAAK,KAAI;AAC1D,YAAA,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE;YACrC,IAAI,IAAI,KAAK,IAAI;A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