From 7edc7677b3dc758ad9d04a47a5daceecfbf39d99 Mon Sep 17 00:00:00 2001 From: Miguel Lehmann Date: Thu, 30 Jan 2025 13:19:05 +0100 Subject: [PATCH] rework buttons in objective form that the e2e test goes through and change logic for the delete load off actions --- frontend/cypress/e2e/objective.cy.ts | 2 +- .../action-plan/action-plan.component.html | 2 +- .../action-plan/action-plan.component.spec.ts | 2 +- .../action-plan/action-plan.component.ts | 10 +--------- .../objective-form.component.html | 17 ++++++++++++++--- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index 8ee4f80b07..a1715d3dab 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -249,7 +249,7 @@ describe('okr objective', () => { cy.contains('Move to another quarter on edit'); }); - it.skip('should have primary button on all objective dialogs', () => { + it('should have primary button on all objective dialogs', () => { overviewPage .addObjective() .fillObjectiveTitle('A objective for testing purposes') diff --git a/frontend/src/app/components/action-plan/action-plan.component.html b/frontend/src/app/components/action-plan/action-plan.component.html index 6a49bb0760..84d0f0ba70 100644 --- a/frontend/src/app/components/action-plan/action-plan.component.html +++ b/frontend/src/app/components/action-plan/action-plan.component.html @@ -12,7 +12,7 @@ >
{ }); - it.skip('should add new action with empty text into array', () => { + it('should add new action with empty text into array', () => { component.addNewItem(); expect(component.getFormControlArray()) .toHaveLength(1); diff --git a/frontend/src/app/components/action-plan/action-plan.component.ts b/frontend/src/app/components/action-plan/action-plan.component.ts index 91a8f1cfb7..5de9477fad 100644 --- a/frontend/src/app/components/action-plan/action-plan.component.ts +++ b/frontend/src/app/components/action-plan/action-plan.component.ts @@ -16,7 +16,7 @@ import { FormControl, FormGroup } from '@angular/forms'; -import { identity, Observable, ReplaySubject } from 'rxjs'; +import { Observable, ReplaySubject } from 'rxjs'; export type FormControlsOf = { [P in keyof T]: AbstractControl; @@ -82,12 +82,6 @@ export class ActionPlanComponent implements AfterContentInit { if (result) { this.getFormControlArray() .removeAt(index); - const rawValue = this.getFormControlArray() - .getRawValue() as Item[]; - this.getFormControlArray() - .clear(); - this.cdRef.detectChanges(); - rawValue.forEach((t) => this.addNewItem(t)); this.cdRef.detectChanges(); if (item.id && this.onDelete) { this.onDelete(item.id) @@ -126,6 +120,4 @@ export class ActionPlanComponent implements AfterContentInit { ngAfterContentInit(): void { this.addItemSubject.subscribe((item) => this.addNewItem(item)); } - - protected readonly identity = identity; } diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html index b7b92383f2..d9b21a2f0e 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html @@ -105,11 +105,22 @@ + +