{"version":3,"file":"ngx-com-components-table-testing.mjs","sources":["../../../projects/com/components/table/testing/table.harness.ts","../../../projects/com/components/table/testing/index.ts","../../../projects/com/components/table/testing/ngx-com-components-table-testing.ts"],"sourcesContent":["import {\n  ComponentHarness,\n  HarnessPredicate,\n  parallel,\n} from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Harness filters for ComTableCellHarness. */\nexport interface ComTableCellHarnessFilters extends BaseHarnessFilters {\n  /** Filter by the cell's text content. */\n  text?: string | RegExp;\n}\n\n/** Harness filters for ComTableRowHarness. */\nexport type ComTableRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableHeaderRowHarness. */\nexport type ComTableHeaderRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableFooterRowHarness. */\nexport type ComTableFooterRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableHarness. */\nexport interface ComTableHarnessFilters extends BaseHarnessFilters {\n  /** Filter by the table's aria-label. */\n  ariaLabel?: string | RegExp;\n}\n\n/**\n * Harness for interacting with a table cell (`<th>` or `<td>`) in tests.\n */\nexport class ComTableCellHarness extends ComponentHarness {\n  static hostSelector = 'th, td';\n\n  /**\n   * Gets a HarnessPredicate for matching table cells.\n   * @param options Filter options.\n   */\n  static with(options: ComTableCellHarnessFilters = {}): HarnessPredicate<ComTableCellHarness> {\n    return new HarnessPredicate(ComTableCellHarness, options)\n      .addOption('text', options.text, async (harness, text) => {\n        const cellText = await harness.getText();\n        return HarnessPredicate.stringMatches(cellText, text);\n      });\n  }\n\n  /** Gets the cell's text content. */\n  async getText(): Promise<string> {\n    const host = await this.host();\n    return host.text();\n  }\n}\n\n/**\n * Harness for interacting with a table header row (`<thead> <tr>`) in tests.\n */\nexport class ComTableHeaderRowHarness extends ComponentHarness {\n  static hostSelector = 'thead tr';\n\n  /**\n   * Gets a HarnessPredicate for matching header rows.\n   * @param options Filter options.\n   */\n  static with(options: ComTableHeaderRowHarnessFilters = {}): HarnessPredicate<ComTableHeaderRowHarness> {\n    return new HarnessPredicate(ComTableHeaderRowHarness, options);\n  }\n\n  /** Gets all header cells in this row, optionally filtered. */\n  async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n    return this.locatorForAll(ComTableCellHarness.with(filters))();\n  }\n\n  /** Gets the text content of all header cells. */\n  async getCellTexts(): Promise<string[]> {\n    const cells = await this.getCells();\n    return parallel(() => cells.map((cell) => cell.getText()));\n  }\n}\n\n/**\n * Harness for interacting with a table body row (`<tbody> <tr>`) in tests.\n */\nexport class ComTableRowHarness extends ComponentHarness {\n  static hostSelector = 'tbody tr';\n\n  /**\n   * Gets a HarnessPredicate for matching body rows.\n   * @param options Filter options.\n   */\n  static with(options: ComTableRowHarnessFilters = {}): HarnessPredicate<ComTableRowHarness> {\n    return new HarnessPredicate(ComTableRowHarness, options);\n  }\n\n  /** Gets all cells in this row, optionally filtered. */\n  async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n    return this.locatorForAll(ComTableCellHarness.with(filters))();\n  }\n\n  /** Gets the text content of all cells in this row. */\n  async getCellTexts(): Promise<string[]> {\n    const cells = await this.getCells();\n    return parallel(() => cells.map((cell) => cell.getText()));\n  }\n\n  /** Clicks the row. Useful for tables with clickable rows. */\n  async click(): Promise<void> {\n    const host = await this.host();\n    return host.click();\n  }\n\n  /** Whether the row is clickable (has tabindex=\"0\"). */\n  async isClickable(): Promise<boolean> {\n    const host = await this.host();\n    return (await host.getAttribute('tabindex')) === '0';\n  }\n}\n\n/**\n * Harness for interacting with a table footer row (`<tfoot> <tr>`) in tests.\n */\nexport class ComTableFooterRowHarness extends ComponentHarness {\n  static hostSelector = 'tfoot tr';\n\n  /**\n   * Gets a HarnessPredicate for matching footer rows.\n   * @param options Filter options.\n   */\n  static with(options: ComTableFooterRowHarnessFilters = {}): HarnessPredicate<ComTableFooterRowHarness> {\n    return new HarnessPredicate(ComTableFooterRowHarness, options);\n  }\n\n  /** Gets all cells in this footer row, optionally filtered. */\n  async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n    return this.locatorForAll(ComTableCellHarness.with(filters))();\n  }\n\n  /** Gets the text content of all cells in this footer row. */\n  async getCellTexts(): Promise<string[]> {\n    const cells = await this.getCells();\n    return parallel(() => cells.map((cell) => cell.getText()));\n  }\n}\n\n/**\n * Harness for interacting with a ComTable in tests.\n */\nexport class ComTableHarness extends ComponentHarness {\n  static hostSelector = 'com-table';\n\n  private readonly tableElement = this.locatorFor('table');\n\n  /**\n   * Gets a HarnessPredicate for matching tables.\n   * @param options Filter options.\n   */\n  static with(options: ComTableHarnessFilters = {}): HarnessPredicate<ComTableHarness> {\n    return new HarnessPredicate(ComTableHarness, options)\n      .addOption('ariaLabel', options.ariaLabel, async (harness, ariaLabel) => {\n        const label = await harness.getAriaLabel();\n        return HarnessPredicate.stringMatches(label, ariaLabel);\n      });\n  }\n\n  /** Gets the table's aria-label. */\n  async getAriaLabel(): Promise<string | null> {\n    const table = await this.tableElement();\n    return table.getAttribute('aria-label');\n  }\n\n  /** Whether the table is currently loading (aria-busy=\"true\"). */\n  async isLoading(): Promise<boolean> {\n    const table = await this.tableElement();\n    return (await table.getAttribute('aria-busy')) === 'true';\n  }\n\n  /** Gets all header rows. */\n  async getHeaderRows(): Promise<ComTableHeaderRowHarness[]> {\n    return this.locatorForAll(ComTableHeaderRowHarness.with({}))();\n  }\n\n  /** Gets the text content of all header cells from the first header row. */\n  async getHeaderCellTexts(): Promise<string[]> {\n    const headerRows = await this.getHeaderRows();\n    if (headerRows.length === 0) {\n      return [];\n    }\n    return headerRows[0]!.getCellTexts();\n  }\n\n  /** Gets all body rows, optionally filtered. */\n  async getRows(filters: ComTableRowHarnessFilters = {}): Promise<ComTableRowHarness[]> {\n    return this.locatorForAll(ComTableRowHarness.with(filters))();\n  }\n\n  /** Gets the number of body rows. */\n  async getRowCount(): Promise<number> {\n    const rows = await this.getRows();\n    return rows.length;\n  }\n\n  /**\n   * Gets the text content of all body cells as a 2D array.\n   * Each inner array contains the cell texts for a single row.\n   */\n  async getCellTexts(): Promise<string[][]> {\n    const rows = await this.getRows();\n    return parallel(() => rows.map((row) => row.getCellTexts()));\n  }\n\n  /** Gets all footer rows. */\n  async getFooterRows(): Promise<ComTableFooterRowHarness[]> {\n    return this.locatorForAll(ComTableFooterRowHarness.with({}))();\n  }\n\n  /** Gets the text content of all footer cells from the first footer row. */\n  async getFooterCellTexts(): Promise<string[]> {\n    const footerRows = await this.getFooterRows();\n    if (footerRows.length === 0) {\n      return [];\n    }\n    return footerRows[0]!.getCellTexts();\n  }\n\n  /** Whether the table is disabled (aria-disabled). */\n  async isDisabled(): Promise<boolean> {\n    const table = await this.tableElement();\n    return (await table.getAttribute('aria-disabled')) === 'true';\n  }\n\n  /** Whether the table host is focused. */\n  async isFocused(): Promise<boolean> {\n    const host = await this.host();\n    return host.isFocused();\n  }\n\n  /** Focuses the table host element. */\n  async focus(): Promise<void> {\n    const host = await this.host();\n    return host.focus();\n  }\n\n  /** Blurs the table host element. */\n  async blur(): Promise<void> {\n    const host = await this.host();\n    return host.blur();\n  }\n}\n","// Testing utilities for the table component\n\nexport {\n  ComTableCellHarness,\n  ComTableHeaderRowHarness,\n  ComTableRowHarness,\n  ComTableFooterRowHarness,\n  ComTableHarness,\n} from './table.harness';\n\nexport type {\n  ComTableCellHarnessFilters,\n  ComTableHeaderRowHarnessFilters,\n  ComTableRowHarnessFilters,\n  ComTableFooterRowHarnessFilters,\n  ComTableHarnessFilters,\n} from './table.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AA4BA;;AAEG;AACG,MAAO,mBAAoB,SAAQ,gBAAgB,CAAA;AACvD,IAAA,OAAO,YAAY,GAAG,QAAQ;AAE9B;;;AAGG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAsC,EAAE,EAAA;AAClD,QAAA,OAAO,IAAI,gBAA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