Skip to content

Commit

Permalink
Format changes and add e2e for not being able to delete a objective
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelMoeri committed Jan 8, 2025
1 parent cbd2117 commit 1524206
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
22 changes: 22 additions & 0 deletions frontend/cypress/e2e/objective-crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ describe('crud operations', () => {
.should('not.exist');
});

it('should not be able to delete a completed objective', () => {
const objectiveTitle = 'Should not delete this completed objective!';
overviewPage.addObjective()
.fillObjectiveTitle(objectiveTitle)
.submit();

overviewPage.getObjectiveByName(objectiveTitle)
.findByTestId('three-dot-menu')
.click();
overviewPage.selectFromThreeDotMenu('Objective abschliessen');
cy.getByTestId('successful')
.click();
cy.getByTestId('submit')
.click();

overviewPage.getObjectiveByName(objectiveTitle)
.findByTestId('three-dot-menu')
.click();
cy.contains('Objective löschen')
.should('not.exist');
});

it('should open objective detail view via click', () => {
overviewPage.getFirstObjective()
.find('.title')
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/app/services/objective-menu-actions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,22 @@ export class ObjectiveMenuActionsService {
}

private getDefaultActions(objective: ObjectiveMin): ObjectiveMenuEntry[] {
return [this.actions.duplicateObjectiveAction(objective),
this.actions.deleteObjectiveAction()];
return [this.actions.duplicateObjectiveAction(objective)];
}

private getDraftMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] {
return [this.actions.editObjectiveAction(objective),
this.getReleaseAction(objective)];
this.getReleaseAction(objective),
this.actions.deleteObjectiveAction()];
}

private getOngoingMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] {
return [this.actions.editObjectiveAction(objective),
return [
this.actions.editObjectiveAction(objective),
this.actions.completeObjectiveAction(objective),
this.actions.objectiveBackToDraft()];
this.actions.objectiveBackToDraft(),
this.actions.deleteObjectiveAction()
];
}

private getCompletedMenuActions(): ObjectiveMenuEntry[] {
Expand Down

0 comments on commit 1524206

Please sign in to comment.