Skip to content

Commit

Permalink
add undefined/null check to addIconSrc so theres always a icon
Browse files Browse the repository at this point in the history
  • Loading branch information
nevio18324 committed Dec 5, 2024
1 parent cb00dff commit 3781c93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/app/components/team/team.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ <h1 id="overview-team-title" class="team-title">{{ OVEntity.team.name }}</h1>
mat-button
>
<span id="add-objective-span" class="d-flex align-items-center add-text">
<img alt="Add key-result button" class="add-cross-button" src="{{ addIconSrc | async }}" />
<img
alt="Add key-result button"
class="add-cross-button"
src="{{ (addIconSrc | async) ?? '/assets/icons/new-icon.svg' }}"
/>
Objective hinzufügen
</span>
</button>
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/app/components/team/team.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,13 @@ describe('TeamComponent', () => {
component.ngOnInit();
expect(component.addIconSrc.value).toBe('/assets/icons/new-icon.svg');
});

it('should still show add objective icon if next value is null', () => {
component.overviewEntity = { ...overViewEntity2 };
component.overviewEntity.writeable = true;
component.ngOnInit();
//@ts-ignore
component.addIconSrc.next(undefined);
expect(component.addIconSrc).toBe('/assets/icons/new-icon.svg');
});
});

0 comments on commit 3781c93

Please sign in to comment.