forked from onecx/onecx-portal-ui-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
markuczy
committed
Apr 3, 2024
1 parent
16345b7
commit c19eecf
Showing
2 changed files
with
43 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 39 additions & 39 deletions
78
libs/angular-accelerator/testing/search-header.harness.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing' | ||
import { PButtonHarness, ButtonHarness } from '@onecx/angular-testing' | ||
import { PButtonHarness } from '@onecx/angular-testing' | ||
import { PageHeaderHarness } from './page-header.harness' | ||
import { SearchConfigHarness } from './search-config.harness' | ||
import { MoreActionsMenuButtonHarness } from './more-actions-menu-button.harness' | ||
|
||
export class SearchHeaderHarness extends ComponentHarness { | ||
static hostSelector = 'ocx-search-header' | ||
|
||
getPageHeader = this.locatorFor(PageHeaderHarness) | ||
getSearchConfig = this.locatorFor(SearchConfigHarness) | ||
getSearchButton = this.locatorFor( | ||
PButtonHarness.with({ | ||
id: 'searchButton', | ||
}) | ||
) | ||
|
||
getResetButton = this.locatorFor( | ||
PButtonHarness.with({ | ||
id: 'resetButton', | ||
}) | ||
) | ||
|
||
getSimpleAdvancedButton = this.locatorForOptional( | ||
PButtonHarness.with({ | ||
id: 'simpleAdvancedButton', | ||
}) | ||
) | ||
|
||
getMoreActionsMenuButton = this.locatorForOptional(MoreActionsMenuButtonHarness) | ||
|
||
async clickResetButton() { | ||
await (await this.getResetButton()).click() | ||
} | ||
static hostSelector = 'ocx-search-header' | ||
|
||
async clickSearchButton() { | ||
await (await this.getSearchButton()).click() | ||
} | ||
getPageHeader = this.locatorFor(PageHeaderHarness) | ||
getSearchConfig = this.locatorFor(SearchConfigHarness) | ||
getSearchButton = this.locatorFor( | ||
PButtonHarness.with({ | ||
id: 'searchButton', | ||
}) | ||
) | ||
|
||
getResetButton = this.locatorFor( | ||
PButtonHarness.with({ | ||
id: 'resetButton', | ||
}) | ||
) | ||
|
||
getSimpleAdvancedButton = this.locatorForOptional( | ||
PButtonHarness.with({ | ||
id: 'simpleAdvancedButton', | ||
}) | ||
) | ||
|
||
async toggleSimpleAdvanced() { | ||
if (await this.getSimpleAdvancedButton()) { | ||
await (await this.getSimpleAdvancedButton())?.click() | ||
} else { | ||
console.warn('No SimpleAdvancedButton is being displayed to toggle, because no advanced form field is defined.') | ||
} | ||
} | ||
} | ||
getMoreActionsMenuButton = this.locatorForOptional(MoreActionsMenuButtonHarness) | ||
|
||
async clickResetButton() { | ||
await (await this.getResetButton()).click() | ||
} | ||
|
||
async clickSearchButton() { | ||
await (await this.getSearchButton()).click() | ||
} | ||
|
||
async toggleSimpleAdvanced() { | ||
if (await this.getSimpleAdvancedButton()) { | ||
await (await this.getSimpleAdvancedButton())?.click() | ||
} else { | ||
console.warn('No SimpleAdvancedButton is being displayed to toggle, because no advanced form field is defined.') | ||
} | ||
} | ||
} |