Skip to content

Commit

Permalink
fix: cleanup naming and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy committed Jan 24, 2024
1 parent 8385357 commit 854c4ec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
ViewChild,
ViewContainerRef,
} from '@angular/core'
import { Observable, from, isObservable, of } from 'rxjs'
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'

import { ButtonDialogButtonDetails, ButtonDialogConfig, ButtonDialogData } from '../../../model/button-dialog'
import { DialogHostComponent } from './dialog-host/dialog-host.component'
import { Observable, from, isObservable, of } from 'rxjs'
import { DialogState } from '../../../services/portal-dialog.service'

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { EventEmitter, Injectable, Type } from '@angular/core'
import { DialogService, DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'
import { TranslateService } from '@ngx-translate/core'
import { Observable } from 'rxjs'
import { DialogService, DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'

import { ButtonDialogComponent } from '../core/components/button-dialog/button-dialog.component'
import { ButtonDialogButtonDetails, ButtonDialogData } from '../model/button-dialog'
import { DialogHostComponent } from '../core/components/button-dialog/dialog-host/dialog-host.component'
import { TranslateService } from '@ngx-translate/core'

type TranslationKeyWithParameters = { key: string; parameters: Record<string, unknown> }
type TranslationKey = string | TranslationKeyWithParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface PButtonDirectiveHarnessFilters extends BaseHarnessFilters {
}

export class PButtonDirectiveHarness extends ComponentHarness {
static hostSelector = 'button'
static hostSelector = 'button[pButton]'

static with(options: PButtonDirectiveHarnessFilters): HarnessPredicate<PButtonDirectiveHarness> {
return new HarnessPredicate(PButtonDirectiveHarness, options).addOption('id', options.id, (harness, id) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing'
import { ButtonHarness } from '../button.harness'

export interface PButtonHarnessFilters extends BaseHarnessFilters {
id?: string
}

export class PButtonHarness extends ComponentHarness {
static hostSelector = 'p-button'

getButton = this.locatorFor('button')
getButtonHarness = this.locatorFor(ButtonHarness)

static with(options: PButtonHarnessFilters): HarnessPredicate<PButtonHarness> {
return new HarnessPredicate(PButtonHarness, 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 click() {
await (await this.getButton()).click()
}

async getLabel(): Promise<string | null> {
return await (await this.getButton()).text()
}

async getIcon(): Promise<string | null> {
return await (await this.host()).getAttribute('ng-reflect-icon')
}

async getDisabled(): Promise<boolean> {
return await (await this.getButtonHarness()).isDisabled()
await (await this.locatorFor('button')()).click()
}
}

0 comments on commit 854c4ec

Please sign in to comment.