{"version":3,"file":"ngx-com-components-calendar-testing.mjs","sources":["../../../projects/com/components/calendar/testing/calendar.harness.ts","../../../projects/com/components/calendar/testing/index.ts","../../../projects/com/components/calendar/testing/ngx-com-components-calendar-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 ComCalendarCellHarness. */\nexport interface ComCalendarCellHarnessFilters extends BaseHarnessFilters {\n  /** Filter by the cell's display text. */\n  text?: string | RegExp;\n  /** Filter by whether the cell is selected. */\n  selected?: boolean;\n  /** Filter by whether the cell is disabled. */\n  disabled?: boolean;\n}\n\n/** Harness filters for ComCalendarHarness. */\nexport type ComCalendarHarnessFilters = BaseHarnessFilters;\n\n/**\n * Harness for interacting with an individual calendar cell in tests.\n */\nexport class ComCalendarCellHarness extends ComponentHarness {\n  static hostSelector = 'com-calendar-cell';\n\n  private readonly button = this.locatorFor('button');\n\n  /**\n   * Gets a HarnessPredicate for matching calendar cells.\n   * @param options Filter options.\n   */\n  static with(options: ComCalendarCellHarnessFilters = {}): HarnessPredicate<ComCalendarCellHarness> {\n    return new HarnessPredicate(ComCalendarCellHarness, options)\n      .addOption('text', options.text, async (harness, text) => {\n        const cellText = await harness.getText();\n        return HarnessPredicate.stringMatches(cellText, text);\n      })\n      .addOption('selected', options.selected, async (harness, selected) => {\n        return (await harness.isSelected()) === selected;\n      })\n      .addOption('disabled', options.disabled, async (harness, disabled) => {\n        return (await harness.isDisabled()) === disabled;\n      });\n  }\n\n  /** Gets the cell's display text. */\n  async getText(): Promise<string> {\n    const btn = await this.button();\n    return (await btn.text()).trim();\n  }\n\n  /** Gets the cell button's aria-label. */\n  async getAriaLabel(): Promise<string | null> {\n    const btn = await this.button();\n    return btn.getAttribute('aria-label');\n  }\n\n  /** Whether the cell is currently selected. */\n  async isSelected(): Promise<boolean> {\n    const btn = await this.button();\n    return (await btn.getAttribute('aria-selected')) === 'true';\n  }\n\n  /** Whether the cell is disabled. */\n  async isDisabled(): Promise<boolean> {\n    const btn = await this.button();\n    return btn.getProperty<boolean>('disabled');\n  }\n\n  /** Whether the cell represents today's date. */\n  async isToday(): Promise<boolean> {\n    const btn = await this.button();\n    return (await btn.getAttribute('aria-current')) === 'date';\n  }\n\n  /** Clicks the cell to select it. */\n  async select(): Promise<void> {\n    const btn = await this.button();\n    return btn.click();\n  }\n\n  /** Focuses the cell button. */\n  async focus(): Promise<void> {\n    const btn = await this.button();\n    return btn.focus();\n  }\n\n  /** Whether the cell button is focused. */\n  async isFocused(): Promise<boolean> {\n    const btn = await this.button();\n    return btn.isFocused();\n  }\n}\n\n/**\n * Harness for interacting with a ComCalendar in tests.\n */\nexport class ComCalendarHarness extends ComponentHarness {\n  static hostSelector = 'com-calendar';\n\n  private readonly prevButton = this.locatorFor('com-calendar-header button:first-of-type');\n  private readonly periodButton = this.locatorFor('com-calendar-header button:nth-of-type(2)');\n  private readonly nextButton = this.locatorFor('com-calendar-header button:last-of-type');\n\n  /**\n   * Gets a HarnessPredicate for matching calendars.\n   * @param options Filter options.\n   */\n  static with(options: ComCalendarHarnessFilters = {}): HarnessPredicate<ComCalendarHarness> {\n    return new HarnessPredicate(ComCalendarHarness, options);\n  }\n\n  /** Gets the period label text (e.g., \"January 2024\", \"2024\", \"2000 – 2023\"). */\n  async getPeriodLabel(): Promise<string> {\n    const btn = await this.periodButton();\n    return (await btn.text()).trim();\n  }\n\n  /** Navigates to the previous period (month, year, or multi-year page). */\n  async goToPreviousPage(): Promise<void> {\n    const btn = await this.prevButton();\n    return btn.click();\n  }\n\n  /** Navigates to the next period (month, year, or multi-year page). */\n  async goToNextPage(): Promise<void> {\n    const btn = await this.nextButton();\n    return btn.click();\n  }\n\n  /** Whether the previous page button is disabled. */\n  async isPreviousDisabled(): Promise<boolean> {\n    const btn = await this.prevButton();\n    return btn.getProperty<boolean>('disabled');\n  }\n\n  /** Whether the next page button is disabled. */\n  async isNextDisabled(): Promise<boolean> {\n    const btn = await this.nextButton();\n    return btn.getProperty<boolean>('disabled');\n  }\n\n  /** Clicks the period button to switch to the next higher view (month → year → multi-year). */\n  async switchView(): Promise<void> {\n    const btn = await this.periodButton();\n    return btn.click();\n  }\n\n  /** Gets the current calendar view. */\n  async getCurrentView(): Promise<'month' | 'year' | 'multi-year'> {\n    const monthView = await this.locatorForOptional('com-calendar-month-view')();\n    if (monthView) return 'month';\n    const yearView = await this.locatorForOptional('com-calendar-year-view')();\n    if (yearView) return 'year';\n    return 'multi-year';\n  }\n\n  /** Gets all calendar cells, optionally filtered. */\n  async getCells(filters: ComCalendarCellHarnessFilters = {}): Promise<ComCalendarCellHarness[]> {\n    return this.locatorForAll(ComCalendarCellHarness.with(filters))();\n  }\n\n  /** Selects a cell by its display text. Throws if no matching cell is found. */\n  async selectCell(text: string): Promise<void> {\n    const cells = await this.getCells({ text });\n    if (cells.length === 0) {\n      throw new Error(`Could not find calendar cell with text \"${text}\"`);\n    }\n    return cells[0]!.select();\n  }\n\n  /** Gets all currently selected cells. */\n  async getSelectedCells(): Promise<ComCalendarCellHarness[]> {\n    return this.getCells({ selected: true });\n  }\n\n  /** Gets the cell representing today, or null if not visible. */\n  async getTodayCell(): Promise<ComCalendarCellHarness | null> {\n    const cells = await this.getCells();\n    for (const cell of cells) {\n      if (await cell.isToday()) {\n        return cell;\n      }\n    }\n    return null;\n  }\n}\n","// Testing utilities for the calendar component\n\nexport { ComCalendarHarness, ComCalendarCellHarness } from './calendar.harness';\n\nexport type { ComCalendarHarnessFilters, ComCalendarCellHarnessFilters } from './calendar.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAmBA;;AAEG;AACG,MAAO,sBAAuB,SAAQ,gBAAgB,CAAA;AAC1D,IAAA,OAAO,YAAY,GAAG,mBAAmB;AAExB,IAAA,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;AAEnD;;;AAGG;AACH,IAAA,O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