Skip to content

Commit

Permalink
rework buttons in objective form that the e2e test goes through and c…
Browse files Browse the repository at this point in the history
…hange logic for the delete load off actions
  • Loading branch information
Miguel7373 committed Jan 30, 2025
1 parent a356177 commit 7edc767
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
>
<div
class="container-fluid"
*ngFor="let item of getFormControlArray().controls!; index as i; trackBy: identity"
*ngFor="let item of getFormControlArray().controls!; index as i;"
[formGroupName]="i"
cdkDrag
[cdkDragDisabled]="!movable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('ActionPlanComponent', () => {
});


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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
FormControl,
FormGroup
} from '@angular/forms';
import { identity, Observable, ReplaySubject } from 'rxjs';
import { Observable, ReplaySubject } from 'rxjs';

export type FormControlsOf<T> = {
[P in keyof T]: AbstractControl<T[P]>;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -126,6 +120,4 @@ export class ActionPlanComponent implements AfterContentInit {
ngAfterContentInit(): void {
this.addItemSubject.subscribe((item) => this.addNewItem(item));
}

protected readonly identity = identity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,22 @@
</button>
<span [ngClass]="data.objective.objectiveId ? 'pe-2': 'pe-2 ps-2'">
<button
mat-button
*ngIf="allowedToSaveBacklog()"
mat-stroked-button
*ngIf="allowedToSaveBacklog() && !data.objective.objectiveId"
[disabled]="objectiveForm.invalid || !allowedToSaveBacklog()"
color="primary"
type="submit"
(click)="onSubmit('ONGOING')"
[attr.data-testId]="'save'"
>
Speichern
</button>

<button
mat-flat-button
*ngIf="allowedToSaveBacklog() && data.objective.objectiveId"
[disabled]="objectiveForm.invalid || !allowedToSaveBacklog()"
color="primary"
[ngClass]="data.objective.objectiveId ? 'mat-mdc-unelevated-button': 'mat-mdc-outlined-button'"
type="submit"
(click)="onSubmit('ONGOING')"
[attr.data-testId]="'save'"
Expand Down

0 comments on commit 7edc767

Please sign in to comment.