{"version":3,"file":"ngx-com-components-carousel-testing.mjs","sources":["../../../projects/com/components/carousel/testing/carousel.harness.ts","../../../projects/com/components/carousel/testing/index.ts","../../../projects/com/components/carousel/testing/ngx-com-components-carousel-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 ComCarouselHarness. */\nexport type ComCarouselHarnessFilters = BaseHarnessFilters;\n\n/**\n * Harness for interacting with a ComCarousel in tests.\n */\nexport class ComCarouselHarness extends ComponentHarness {\n  static hostSelector = 'com-carousel';\n\n  private readonly prevButton = this.locatorForOptional('button[aria-label=\"Previous slide\"]');\n  private readonly nextButton = this.locatorForOptional('button[aria-label=\"Next slide\"]');\n  private readonly paginationTablist = this.locatorForOptional('div[role=\"tablist\"][aria-label=\"Slide navigation\"]');\n  private readonly paginationDots = this.locatorForAll('button[role=\"tab\"]');\n  private readonly slides = this.locatorForAll('[comCarouselItem]');\n\n  /**\n   * Gets a HarnessPredicate for matching carousels.\n   * @param options Filter options.\n   */\n  static with(options: ComCarouselHarnessFilters = {}): HarnessPredicate<ComCarouselHarness> {\n    return new HarnessPredicate(ComCarouselHarness, options);\n  }\n\n  /** Navigates to the next slide. Throws if the next button is not present. */\n  async goToNext(): Promise<void> {\n    const btn = await this.nextButton();\n    if (!btn) {\n      throw new Error('Next slide button is not present');\n    }\n    return btn.click();\n  }\n\n  /** Navigates to the previous slide. Throws if the previous button is not present. */\n  async goToPrevious(): Promise<void> {\n    const btn = await this.prevButton();\n    if (!btn) {\n      throw new Error('Previous slide button is not present');\n    }\n    return btn.click();\n  }\n\n  /** Navigates to a specific slide by clicking its pagination dot. Throws if not found. */\n  async goToSlide(index: number): Promise<void> {\n    const dots = await this.paginationDots();\n    if (index < 0 || index >= dots.length) {\n      throw new Error(`Pagination dot at index ${index} is not present`);\n    }\n    return dots[index]!.click();\n  }\n\n  /** Gets the index of the currently active slide based on the selected pagination dot. */\n  async getCurrentIndex(): Promise<number> {\n    const dots = await this.paginationDots();\n    for (let i = 0; i < dots.length; i++) {\n      if ((await dots[i]!.getAttribute('aria-selected')) === 'true') {\n        return i;\n      }\n    }\n    return -1;\n  }\n\n  /** Gets the total number of slide items. */\n  async getSlideCount(): Promise<number> {\n    const items = await this.slides();\n    return items.length;\n  }\n\n  /** Whether the next slide button is disabled. */\n  async isNextDisabled(): Promise<boolean> {\n    const btn = await this.nextButton();\n    if (!btn) {\n      throw new Error('Next slide button is not present');\n    }\n    return btn.getProperty<boolean>('disabled');\n  }\n\n  /** Whether the previous slide button is disabled. */\n  async isPreviousDisabled(): Promise<boolean> {\n    const btn = await this.prevButton();\n    if (!btn) {\n      throw new Error('Previous slide button is not present');\n    }\n    return btn.getProperty<boolean>('disabled');\n  }\n\n  /** Whether navigation buttons (next/previous) are present. */\n  async hasNavigation(): Promise<boolean> {\n    const btn = await this.nextButton();\n    return btn !== null;\n  }\n\n  /** Whether the pagination tablist is present. */\n  async hasPagination(): Promise<boolean> {\n    const tablist = await this.paginationTablist();\n    return tablist !== null;\n  }\n\n  /** Gets the number of pagination dots. */\n  async getPaginationCount(): Promise<number> {\n    const dots = await this.paginationDots();\n    return dots.length;\n  }\n\n  /** Whether the carousel is disabled (both navigation buttons disabled). */\n  async isDisabled(): Promise<boolean> {\n    const hasNav = await this.hasNavigation();\n    if (!hasNav) return false;\n    return (await this.isPreviousDisabled()) && (await this.isNextDisabled());\n  }\n\n  /** Whether the carousel host is focused. */\n  async isFocused(): Promise<boolean> {\n    const host = await this.host();\n    return host.isFocused();\n  }\n\n  /** Focuses the carousel host element. */\n  async focus(): Promise<void> {\n    const host = await this.host();\n    return host.focus();\n  }\n\n  /** Blurs the carousel host element. */\n  async blur(): Promise<void> {\n    const host = await this.host();\n    return host.blur();\n  }\n}\n","// Testing utilities for the carousel component\n\nexport { ComCarouselHarness } from './carousel.harness';\n\nexport type { ComCarouselHarnessFilters } from './carousel.harness';\n","/**\n *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