From a92e0dc709bd680bfc1c3a7df0e9b080bf7971b1 Mon Sep 17 00:00:00 2001 From: Aryan Date: Sat, 10 Feb 2024 14:47:09 +0530 Subject: [PATCH] fix #247 --- .../activity-description.component.html | 18 +++--- .../activity-description.component.spec.ts | 63 ++++++++++--------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/app/component/activity-description/activity-description.component.html b/src/app/component/activity-description/activity-description.component.html index c71c118e..4384009f 100644 --- a/src/app/component/activity-description/activity-description.component.html +++ b/src/app/component/activity-description/activity-description.component.html @@ -16,7 +16,7 @@

UUID -

+

@@ -25,7 +25,7 @@

Description -

+

@@ -34,7 +34,7 @@

Risk -

+

@@ -43,7 +43,7 @@

Measure -

+

@@ -52,7 +52,9 @@

Implementation Guide -

+

@@ -83,7 +85,7 @@

Evidence -

+

@@ -92,7 +94,7 @@

Assessment -

+

@@ -247,7 +249,7 @@

Comments -

+

diff --git a/src/app/component/activity-description/activity-description.component.spec.ts b/src/app/component/activity-description/activity-description.component.spec.ts index a19e887f..31445f08 100644 --- a/src/app/component/activity-description/activity-description.component.spec.ts +++ b/src/app/component/activity-description/activity-description.component.spec.ts @@ -28,7 +28,7 @@ describe('ActivityDescriptionComponent', () => { expect(component).toBeTruthy(); }); - it('check if header is being genenrated', () => { + it('check if header is being generated', () => { const testDimension = 'Sample Dimension'; const testSubDimension = 'Sample subDimension'; component.currentActivity.dimension = testDimension; @@ -40,88 +40,89 @@ describe('ActivityDescriptionComponent', () => { expect(heading.textContent).toContain(testSubDimension); }); - it('check if UUID is being genenrated', () => { + it('check if UUID is being generated', () => { const testUUID = '00000000-0000-0000-0000-000000000000'; component.currentActivity.uuid = testUUID; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[0].textContent).toContain(testUUID); + const contentDisplayedinParagraphTag = HTMLElement.querySelector('#uuid')!; + expect(contentDisplayedinParagraphTag.textContent).toContain(testUUID); }); - it('check if description is being genenrated', () => { + it('check if description is being generated', () => { const testDescription = 'Sample Description'; component.currentActivity.description = testDescription; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[1].textContent).toContain( + const contentDisplayedinParagraphTag = + HTMLElement.querySelector('#description')!; + expect(contentDisplayedinParagraphTag.textContent).toContain( testDescription ); }); - it('check if risk is being genenrated', () => { + it('check if risk is being generated', () => { const testRisk = 'Sample Risk'; component.currentActivity.risk = testRisk; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[2].textContent).toContain(testRisk); + const contentDisplayedinParagraphTag = HTMLElement.querySelector('#risk')!; + expect(contentDisplayedinParagraphTag.textContent).toContain(testRisk); }); - it('check if measure is being genenrated', () => { + it('check if measure is being generated', () => { const testMeasure = 'Sample Measure'; component.currentActivity.measure = testMeasure; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[3].textContent).toContain( - testMeasure - ); + const contentDisplayedinParagraphTag = + HTMLElement.querySelector('#measure')!; + expect(contentDisplayedinParagraphTag.textContent).toContain(testMeasure); }); - it('check if implementation guide is being genenrated', () => { + it('check if implementation guide is being generated', () => { const testImplementationGuide = 'Sample Implementation Guide'; component.currentActivity.implementatonGuide = testImplementationGuide; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[4].textContent).toContain( + const contentDisplayedinParagraphTag = HTMLElement.querySelector( + '#implementatonGuide' + )!; + expect(contentDisplayedinParagraphTag.textContent).toContain( testImplementationGuide ); }); - it('check if evidence is being genenrated', () => { + it('check if evidence is being generated', () => { const testEvidence = 'Sample Evidence'; component.currentActivity.evidence = testEvidence; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[7].textContent).toContain( - testEvidence - ); + const contentDisplayedinParagraphTag = + HTMLElement.querySelector('#evidence')!; + expect(contentDisplayedinParagraphTag.textContent).toContain(testEvidence); }); - it('check if assessment is being genenrated', () => { + it('check if assessment is being generated', () => { const testAssessment = 'Sample Assessment'; component.currentActivity.assessment = testAssessment; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[8].textContent).toContain( + const contentDisplayedinParagraphTag = + HTMLElement.querySelector('#assessment')!; + expect(contentDisplayedinParagraphTag.textContent).toContain( testAssessment ); }); - it('check if comments is being genenrated', () => { + it('check if comments is being generated', () => { const testComments = 'Sample Comments'; component.currentActivity.comments = testComments; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[11].textContent).toContain( - testComments - ); + const contentDisplayedinParagraphTag = + HTMLElement.querySelector('#comments')!; + expect(contentDisplayedinParagraphTag.textContent).toContain(testComments); }); it('check if references is being generated', () => {