diff --git a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.html b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.html index c2f12a510..af31e4d6d 100644 --- a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.html +++ b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.html @@ -77,12 +77,20 @@ Save Draft + { fixture.detectChanges(); }); + it('should has Discard text', () => { + const discardButton = compiled.querySelector( + '.discard-button' + ) as HTMLButtonElement; + + expect(discardButton.textContent?.trim()).toEqual('Discard'); + }); + it('should be enabled when form is filled', () => { const discardButton = compiled.querySelector( '.discard-button' @@ -433,6 +441,34 @@ describe('ProfileFormComponent', () => { ).toBeTrue(); }); }); + + describe('Close button', () => { + it('should has Discard text', () => { + const discardButton = compiled.querySelector( + '.discard-button' + ) as HTMLButtonElement; + + expect(discardButton.textContent?.trim()).toEqual('Close'); + }); + + it('should be enabled', () => { + const discardButton = compiled.querySelector( + '.discard-button' + ) as HTMLButtonElement; + + expect(discardButton.disabled).toBeFalse(); + }); + + it('should emit discard', () => { + const emitSpy = spyOn(component.discard, 'emit'); + const discardButton = compiled.querySelector( + '.discard-button' + ) as HTMLButtonElement; + discardButton.click(); + + expect(emitSpy).toHaveBeenCalled(); + }); + }); }); });