diff --git a/apps/web/src/app/features/combat/combat-page/combat-page.component.spec.ts b/apps/web/src/app/features/combat/combat-page/combat-page.component.spec.ts index 6ea1da3..b2ebffc 100644 --- a/apps/web/src/app/features/combat/combat-page/combat-page.component.spec.ts +++ b/apps/web/src/app/features/combat/combat-page/combat-page.component.spec.ts @@ -114,20 +114,39 @@ describe('CombatPageComponent', () => { expect(element.querySelector('[data-combat-potion]')?.textContent).toContain('Trank 2/2'); }); - it('sends the matching action for each of the four new buttons', async () => { + it('sends HEAVY_STRIKE when Schwerer Hieb is clicked', async () => { const fixture = await setup(activeCombat); const element = fixture.nativeElement as HTMLElement; element.querySelector('[data-combat-heavy-strike]')?.click(); + expect(combatStore.performAction).toHaveBeenCalledWith('HEAVY_STRIKE'); + }); + + it('sends SHIELD_BASH when Schildstoß is clicked', async () => { + const fixture = await setup(activeCombat); + const element = fixture.nativeElement as HTMLElement; element.querySelector('[data-combat-shield-bash]')?.click(); + expect(combatStore.performAction).toHaveBeenCalledWith('SHIELD_BASH'); + }); + + it('sends DEFEND when Verteidigen is clicked', async () => { + const fixture = await setup(activeCombat); + const element = fixture.nativeElement as HTMLElement; element.querySelector('[data-combat-defend]')?.click(); + expect(combatStore.performAction).toHaveBeenCalledWith('DEFEND'); + }); + + it('sends POTION when Trank is clicked', async () => { + const fixture = await setup(activeCombat); + const element = fixture.nativeElement as HTMLElement; element.querySelector('[data-combat-potion]')?.click(); + expect(combatStore.performAction).toHaveBeenCalledWith('POTION'); }); diff --git a/apps/web/src/app/features/combat/combat-page/combat-page.component.ts b/apps/web/src/app/features/combat/combat-page/combat-page.component.ts index c1f7890..8869c33 100644 --- a/apps/web/src/app/features/combat/combat-page/combat-page.component.ts +++ b/apps/web/src/app/features/combat/combat-page/combat-page.component.ts @@ -82,7 +82,7 @@ export class CombatPageComponent implements OnInit { protected async performAction(action: CombatAction): Promise { const before = this.displayed(); - if (!before) { + if (!before || this.busy()) { return; }