{"version":3,"file":"skyux-inline-form-testing.mjs","sources":["../../../../../libs/components/inline-form/testing/src/modules/inline-form/inline-form-button-harness.ts","../../../../../libs/components/inline-form/testing/src/modules/inline-form/inline-form-template-harness.ts","../../../../../libs/components/inline-form/testing/src/modules/inline-form/inline-form-harness.ts","../../../../../libs/components/inline-form/testing/src/skyux-inline-form-testing.ts"],"sourcesContent":["import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport { SkyInlineFormButtonHarnessFilters } from './inline-form-button-harness.filters';\n\n/**\n * Harness to interact with inline form button component in tests.\n */\nexport class SkyInlineFormButtonHarness extends ComponentHarness {\n  /**\n   * @internal\n   */\n  public static hostSelector = '.sky-inline-form-footer > button';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a\n   * `SkyInlineFormButtonHarness` that meets certain criteria.\n   */\n  public static with(\n    filters: SkyInlineFormButtonHarnessFilters,\n  ): HarnessPredicate<SkyInlineFormButtonHarness> {\n    return new HarnessPredicate(SkyInlineFormButtonHarness, filters)\n      .addOption('text', filters.text, async (harness, text) => {\n        const harnessText = await harness.getText();\n        return await HarnessPredicate.stringMatches(harnessText, text);\n      })\n      .addOption('styleType', filters.styleType, async (harness, styleType) => {\n        const harnessStyleType = await harness.getStyleType();\n        return await HarnessPredicate.stringMatches(\n          harnessStyleType,\n          styleType,\n        );\n      });\n  }\n\n  /**\n   * Clicks the button.\n   */\n  public async click(): Promise<void> {\n    return await (await this.host()).click();\n  }\n\n  /**\n   * Gets the button style type.\n   */\n  public async getStyleType(): Promise<'primary' | 'link' | 'default'> {\n    const host = await this.host();\n    if (await host.hasClass('sky-btn-primary')) {\n      return 'primary';\n    }\n    if (await host.hasClass('sky-btn-link')) {\n      return 'link';\n    }\n    return 'default';\n  }\n\n  /**\n   * Gets the button text.\n   */\n  public async getText(): Promise<string> {\n    return await (await this.host()).text();\n  }\n\n  /**\n   * Whether the button is disabled.\n   */\n  public async isDisabled(): Promise<boolean> {\n    return await (await this.host()).hasClass('sky-btn-disabled');\n  }\n}\n","import { SkyQueryableComponentHarness } from '@skyux/core/testing';\n\n/**\n * Harness to interact with inline form template components in tests.\n */\nexport class SkyInlineFormTemplateHarness extends SkyQueryableComponentHarness {\n  /**\n   * @internal\n   */\n  public static hostSelector = '.sky-inline-form-content';\n}\n","import { HarnessPredicate } from '@angular/cdk/testing';\nimport { SkyQueryableComponentHarness } from '@skyux/core/testing';\n\nimport { SkyInlineFormButtonHarness } from './inline-form-button-harness';\nimport { SkyInlineFormButtonHarnessFilters } from './inline-form-button-harness.filters';\nimport { SkyInlineFormHarnessFilters } from './inline-form-harness.filters';\nimport { SkyInlineFormTemplateHarness } from './inline-form-template-harness';\n\n/**\n * Harness to interact with inline form components in tests.\n */\nexport class SkyInlineFormHarness extends SkyQueryableComponentHarness {\n  /**\n   * @internal\n   */\n  public static hostSelector = 'sky-inline-form';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a\n   * `SkyInlineFormHarness` that meets certain criteria.\n   */\n  public static with(\n    filters: SkyInlineFormHarnessFilters,\n  ): HarnessPredicate<SkyInlineFormHarness> {\n    return SkyInlineFormHarness.getDataSkyIdPredicate(filters);\n  }\n\n  /**\n   * Gets a specific inline form button based on the filter criteria.\n   * @param filters The filter criteria.\n   */\n  public async getButton(\n    filters: SkyInlineFormButtonHarnessFilters,\n  ): Promise<SkyInlineFormButtonHarness> {\n    if (!(await this.isFormExpanded())) {\n      throw new Error(\n        'Inline form is not expanded. The buttons cannot be retrieved when not visible.',\n      );\n    }\n    return await this.locatorFor(SkyInlineFormButtonHarness.with(filters))();\n  }\n\n  /**\n   * Gets an array of inline form buttons based on the filter criteria.\n   * If no filter is provided, returns all inline form buttons.\n   * @param filters The optional filter criteria.\n   */\n  public async getButtons(\n    filters?: SkyInlineFormButtonHarnessFilters,\n  ): Promise<SkyInlineFormButtonHarness[]> {\n    if (!(await this.isFormExpanded())) {\n      throw new Error(\n        'Inline form is not expanded. The buttons cannot be retrieved when not visible.',\n      );\n    }\n    return await this.locatorForAll(\n      SkyInlineFormButtonHarness.with(filters || {}),\n    )();\n  }\n\n  /**\n   * Returns a harness wrapping the inline form's template when expanded.\n   */\n  public async getTemplate(): Promise<SkyInlineFormTemplateHarness> {\n    if (!(await this.isFormExpanded())) {\n      throw new Error(\n        'Inline form is not expanded. Cannot retrieve template when not visible.',\n      );\n    }\n\n    return await this.locatorFor(SkyInlineFormTemplateHarness)();\n  }\n\n  /**\n   * Whether the inline form is shown.\n   */\n  public async isFormExpanded(): Promise<boolean> {\n    return (\n      (await (await this.host()).getAttribute('data-show-form')) === 'true'\n    );\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACG,MAAO,0BAA2B,SAAQ,gBAAgB,CAAA;AAC9D;;AAEG;aACW,IAAA,CAAA,YAAY,GAAG,kCAAkC,CAAC;AAEhE;;;AAGG;IACI,OAAO,IAAI,CAChB,OAA0C,EAAA;AAE1C,QAAA,OAAO,IAAI,gBAAgB,CAAC,0BAA0B,EAAE,OAAO;AAC5D,aAAA,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,KAAI;AACvD,YAAA,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE;YAC3C,OAAO,MAAM,gBAAgB,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC;AAChE,QAAA,CAAC;AACA,aAAA,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,OAAO,EAAE,SAAS,KAAI;AACtE,YAAA,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,YAAY,EAAE;YACrD,OAAO,MAAM,gBAAgB,CAAC,aAAa,CACzC,gBAAgB,EAChB,SAAS,CACV;AACH,QAAA,CAAC,CAAC;IACN;AAEA;;AAEG;AACI,IAAA,MAAM,KAAK,GAAA;QAChB,OAAO,MAAM,CAAC,MAAM,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