From 1f0e543c47d7c6e01cdcefa294be1a6ce6d2dcd2 Mon Sep 17 00:00:00 2001 From: "Lisa Flinn (She/Her)" Date: Fri, 10 May 2024 13:06:08 +0100 Subject: [PATCH 1/2] initial fix --- src/app/components/rating/rating.spec.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/components/rating/rating.spec.ts b/src/app/components/rating/rating.spec.ts index cf51231a69e..5b8c0126e19 100755 --- a/src/app/components/rating/rating.spec.ts +++ b/src/app/components/rating/rating.spec.ts @@ -6,7 +6,7 @@ import { StarFillIcon } from 'primeng/icons/starfill'; import { StarIcon } from 'primeng/icons/star'; import { BanIcon } from 'primeng/icons/ban'; -describe('Rating', () => { +fdescribe('Rating', () => { let rating: Rating; let fixture: ComponentFixture; @@ -62,8 +62,8 @@ describe('Rating', () => { fixture.detectChanges(); const starElements = fixture.debugElement.queryAll(By.css('span')); - expect(starElements[0].nativeElement.className).toContain('Primeng Rocks!'); - expect(starElements[0].nativeElement.style.height).toEqual('300px'); + expect(starElements[1].nativeElement.className).toContain('Primeng Rocks!'); + expect(starElements[1].nativeElement.style.height).toEqual('300px'); }); it('should value 3', () => { @@ -86,11 +86,18 @@ describe('Rating', () => { rating.onRate.subscribe((value) => (onRateValue = value)); rating.onCancel.subscribe((value) => (onCancelRate = value)); thirdStarEl.parentElement.click(); - cancelEl.parentElement.click(); fixture.detectChanges(); expect(onRateValue.value).toEqual(3); - expect(onCancelRate).toBeTruthy(); + + const cancelspy = spyOn(rating.onCancel, 'emit').and.callThrough(); + const onModelChangeSpy = spyOn(rating, 'onModelChange').and.callThrough(); + cancelEl.parentElement.click(); + fixture.detectChanges(); + + expect(onModelChangeSpy).toHaveBeenCalled(); + expect(rating.value).toEqual(null); + expect(cancelspy).toHaveBeenCalled(); }); it('should clear value', () => { From c11ff74a21d8c372bf7e1020b048f5ee7e9f04b3 Mon Sep 17 00:00:00 2001 From: "Lisa Flinn (She/Her)" Date: Fri, 10 May 2024 13:11:33 +0100 Subject: [PATCH 2/2] rm fdescribe --- src/app/components/rating/rating.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/rating/rating.spec.ts b/src/app/components/rating/rating.spec.ts index 5b8c0126e19..344abc8adab 100755 --- a/src/app/components/rating/rating.spec.ts +++ b/src/app/components/rating/rating.spec.ts @@ -6,7 +6,7 @@ import { StarFillIcon } from 'primeng/icons/starfill'; import { StarIcon } from 'primeng/icons/star'; import { BanIcon } from 'primeng/icons/ban'; -fdescribe('Rating', () => { +describe('Rating', () => { let rating: Rating; let fixture: ComponentFixture;