diff --git a/src/app/fight/fight.component.html b/src/app/fight/fight.component.html
index ecf0fee..6cdc9e5 100644
--- a/src/app/fight/fight.component.html
+++ b/src/app/fight/fight.component.html
@@ -2,60 +2,64 @@
-->
@for (hpEvent of hpEvents(); track $index) {
-
+
}
-
+
@if (winnerEvent()) {
@if (winnerEvent()?.attacker?.length === 0) {
-
+
DOBLE K.O.!
} @else {
ยก{{ winnerEvent()?.attacker }} ha ganado!
}
}
@for (event of roundEvents(); track $index) {
-
+
}
@@ -70,4 +74,4 @@
}
-
\ No newline at end of file
+
diff --git a/src/app/fight/fight.component.spec.ts b/src/app/fight/fight.component.spec.ts
index 345e153..67f63c0 100644
--- a/src/app/fight/fight.component.spec.ts
+++ b/src/app/fight/fight.component.spec.ts
@@ -8,6 +8,7 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'
describe('FightComponent', () => {
let component: FightComponent
let fixture: ComponentFixture
+ let fightEl: HTMLElement
beforeEach(async () => {
await TestBed.configureTestingModule({
@@ -21,10 +22,23 @@ describe('FightComponent', () => {
fixture = TestBed.createComponent(FightComponent)
component = fixture.componentInstance
+ fightEl = fixture.nativeElement
fixture.detectChanges()
})
it('should create', () => {
- expect(component).toBeTruthy()
+ component.leftCharacterInitialHealth = 100
+ component.rightCharacterInitialHealth = 100
+ fixture.detectChanges()
+
+ const leftHealthBar = fightEl.querySelector(
+ '.left-health-bar',
+ ) as HTMLElement
+ const rightHealthBar = fightEl.querySelector(
+ '.right-health-bar',
+ ) as HTMLElement
+
+ expect(leftHealthBar.textContent).toContain('/ 100')
+ expect(rightHealthBar.textContent).toContain('/ 100')
})
})