From cd74c1f31ab7f06e089e7142b79441c9fc39aee6 Mon Sep 17 00:00:00 2001 From: benjamin Date: Thu, 14 May 2026 18:06:01 +0200 Subject: [PATCH] fix adding song, with no editable show --- .../modules/songs/song/song.component.html | 34 +++++++++++-------- .../modules/songs/song/song.component.spec.ts | 7 ++++ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/app/modules/songs/song/song.component.html b/src/app/modules/songs/song/song.component.html index c07a40a..801106f 100644 --- a/src/app/modules/songs/song/song.component.html +++ b/src/app/modules/songs/song/song.component.html @@ -47,21 +47,25 @@
{{ song.comment }}
- Löschen - Bearbeiten - - Zu Veranstaltung hinzufügen - - @for (show of privateShows$|async; track show.id) { - {{ show.date.toDate() | date: "dd.MM.yyyy" }} {{ show.showType | showType }} - - } - - - - - } + Löschen + Bearbeiten + + @if (privateShows$ | async; as privateShows) { + @if (privateShows.length > 0) { + Zu Veranstaltung hinzufügen + + @for (show of privateShows; track show.id) { + {{ show.date.toDate() | date: "dd.MM.yyyy" }} {{ show.showType | showType }} + + } + + } + } + + + + } @if (files$ | async; as files) { @if (files.length > 0) { diff --git a/src/app/modules/songs/song/song.component.spec.ts b/src/app/modules/songs/song/song.component.spec.ts index 445baa0..f9955e5 100644 --- a/src/app/modules/songs/song/song.component.spec.ts +++ b/src/app/modules/songs/song/song.component.spec.ts @@ -55,4 +55,11 @@ describe('SongComponent', () => { it('should create', () => { void expect(component).toBeTruthy(); }); + + it('should hide add-to-show when there are no private shows', () => { + const buttons = Array.from(fixture.nativeElement.querySelectorAll('app-button button')) as HTMLButtonElement[]; + const addButton = buttons.find(button => button.textContent?.includes('Zu Veranstaltung hinzufügen')); + + void expect(addButton).toBeUndefined(); + }); });