Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: p-password harness #254

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/angular-testing/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './lib/harnesses/primeng/p-dropdown.harness'
export * from './lib/harnesses/primeng/p-menu.harness'
export * from './lib/harnesses/primeng/p-multiSelect.harness'
export * from './lib/harnesses/primeng/p-multiSelectListItem.harness'
export * from './lib/harnesses/primeng/p-password.harness'
export * from './lib/harnesses/primeng/p-picklist.harness'
export * from './lib/harnesses/primeng/p-selectButton.harness'
export * from './lib/harnesses/primeng/p-paginator.harness'
Expand Down
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)
}
}
Loading