-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: p-password harness added * fix: export harness
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 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
45 changes: 45 additions & 0 deletions
45
libs/angular-testing/src/lib/harnesses/primeng/p-password.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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing' | ||
import { InputHarness } from '../input.harness' | ||
|
||
export interface PPasswordHarnessFilters extends BaseHarnessFilters { | ||
id?: string | ||
} | ||
|
||
export class PPasswordHarness extends ComponentHarness { | ||
static hostSelector = 'p-password' | ||
|
||
getInput = this.locatorFor(InputHarness) | ||
|
||
static with(options: PPasswordHarnessFilters): HarnessPredicate<PPasswordHarness> { | ||
return new HarnessPredicate(PPasswordHarness, options).addOption('id', options.id, (harness, id) => | ||
HarnessPredicate.stringMatches(harness.getId(), id) | ||
) | ||
} | ||
async getId(): Promise<string | null> { | ||
return await (await this.host()).getAttribute('id') | ||
} | ||
|
||
async getPromptLabel(): Promise<string | null> { | ||
return await (await this.host()).getAttribute('ng-reflect-prompt-label') | ||
} | ||
|
||
async getWeakLabel(): Promise<string | null> { | ||
return await (await this.host()).getAttribute('ng-reflect-weak-label') | ||
} | ||
|
||
async getMediumLabel(): Promise<string | null> { | ||
return await (await this.host()).getAttribute('ng-reflect-medium-label') | ||
} | ||
|
||
async getStrongLabel(): Promise<string | null> { | ||
return await (await this.host()).getAttribute('ng-reflect-strong-label') | ||
} | ||
|
||
async getValue(): Promise<string | null> { | ||
return await (await this.getInput()).getValue() | ||
} | ||
|
||
async setValue(value: string) { | ||
return await (await this.getInput()).setValue(value) | ||
} | ||
} |