From 854c4ecbcf95d8c9c7c1d35c249b36b3db8bf901 Mon Sep 17 00:00:00 2001 From: markuczy Date: Wed, 24 Jan 2024 19:54:51 +0100 Subject: [PATCH] fix: cleanup naming and imports --- .../button-dialog/button-dialog.component.ts | 3 ++- .../src/lib/services/portal-dialog.service.ts | 5 +++-- .../primeng/p-button-directive.harness.ts | 2 +- .../testing/primeng/p-button.harness.ts | 20 +------------------ 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/libs/portal-integration-angular/src/lib/core/components/button-dialog/button-dialog.component.ts b/libs/portal-integration-angular/src/lib/core/components/button-dialog/button-dialog.component.ts index 6d21f1ce..d3f048b6 100644 --- a/libs/portal-integration-angular/src/lib/core/components/button-dialog/button-dialog.component.ts +++ b/libs/portal-integration-angular/src/lib/core/components/button-dialog/button-dialog.component.ts @@ -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({ diff --git a/libs/portal-integration-angular/src/lib/services/portal-dialog.service.ts b/libs/portal-integration-angular/src/lib/services/portal-dialog.service.ts index 24193ea9..0ed3921b 100644 --- a/libs/portal-integration-angular/src/lib/services/portal-dialog.service.ts +++ b/libs/portal-integration-angular/src/lib/services/portal-dialog.service.ts @@ -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 } type TranslationKey = string | TranslationKeyWithParameters diff --git a/libs/portal-integration-angular/testing/primeng/p-button-directive.harness.ts b/libs/portal-integration-angular/testing/primeng/p-button-directive.harness.ts index d3d4f4ff..9e750a27 100644 --- a/libs/portal-integration-angular/testing/primeng/p-button-directive.harness.ts +++ b/libs/portal-integration-angular/testing/primeng/p-button-directive.harness.ts @@ -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 { return new HarnessPredicate(PButtonDirectiveHarness, options).addOption('id', options.id, (harness, id) => diff --git a/libs/portal-integration-angular/testing/primeng/p-button.harness.ts b/libs/portal-integration-angular/testing/primeng/p-button.harness.ts index dc5ad65d..517cbe7f 100644 --- a/libs/portal-integration-angular/testing/primeng/p-button.harness.ts +++ b/libs/portal-integration-angular/testing/primeng/p-button.harness.ts @@ -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 { return new HarnessPredicate(PButtonHarness, options).addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id) ) } - async getId(): Promise { return await (await this.host()).getAttribute('id') } async click() { - await (await this.getButton()).click() - } - - async getLabel(): Promise { - return await (await this.getButton()).text() - } - - async getIcon(): Promise { - return await (await this.host()).getAttribute('ng-reflect-icon') - } - - async getDisabled(): Promise { - return await (await this.getButtonHarness()).isDisabled() + await (await this.locatorFor('button')()).click() } }