diff --git a/.prettierignore b/.prettierignore index 183b3084..353e4b75 100644 --- a/.prettierignore +++ b/.prettierignore @@ -42,3 +42,5 @@ testem.log # System Files .DS_Store Thumbs.db + +/src/assets/YAML/generated/generated.yaml \ No newline at end of file diff --git a/src/app/component/activity-description/activity-description.component.html b/src/app/component/activity-description/activity-description.component.html index 4384009f..01955440 100644 --- a/src/app/component/activity-description/activity-description.component.html +++ b/src/app/component/activity-description/activity-description.component.html @@ -82,10 +82,21 @@

- Evidence + Teams Evidence -

+ + + + + + + +

+
+
@@ -153,7 +164,7 @@

References -

+

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 31445f08..f4ffe622 100644 --- a/src/app/component/activity-description/activity-description.component.spec.ts +++ b/src/app/component/activity-description/activity-description.component.spec.ts @@ -94,13 +94,17 @@ describe('ActivityDescriptionComponent', () => { }); it('check if evidence is being generated', () => { - const testEvidence = 'Sample Evidence'; - component.currentActivity.evidence = testEvidence; + const testEvidence = { A: 'Sample Evidence', Default: 'Sample evidence 2' }; + component.currentActivity.teamsEvidence = testEvidence; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = - HTMLElement.querySelector('#evidence')!; - expect(contentDisplayedinParagraphTag.textContent).toContain(testEvidence); + const parentElement = HTMLElement.querySelectorAll('#teamsEvidence')!; + console.log('parentElement', parentElement[1].textContent); + const lengthOfObject = Object.keys(testEvidence).length; + for (var i = 0; i > lengthOfObject; i++) + expect(parentElement[i].textContent).toContain( + Object.keys(testEvidence)[i] + Object.values(testEvidence)[i] + ); }); it('check if assessment is being generated', () => { @@ -138,8 +142,10 @@ describe('ActivityDescriptionComponent', () => { fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[10].textContent).toContain( + const contentDisplayedinParagraphTag = + HTMLElement.querySelectorAll('#references')!; + + expect(contentDisplayedinParagraphTag[0].textContent).toContain( component.SAMMVersion + testSAMM[0] + component.ISOVersion + diff --git a/src/app/component/activity-description/activity-description.component.ts b/src/app/component/activity-description/activity-description.component.ts index 85cc23ef..37f6abba 100644 --- a/src/app/component/activity-description/activity-description.component.ts +++ b/src/app/component/activity-description/activity-description.component.ts @@ -32,6 +32,7 @@ export interface activityDescription { implementation: implementation[]; usefulness: number; evidence: string; + teamsEvidence: Object; assessment: string; comments: string; isImplemented: boolean; @@ -67,6 +68,7 @@ export class ActivityDescriptionComponent implements OnInit { usefulness: -1, assessment: '', evidence: '', + teamsEvidence: {}, comments: '', isImplemented: false, teamsImplemented: {}, @@ -261,6 +263,10 @@ export class ActivityDescriptionComponent implements OnInit { false ); this.currentActivity.teamsImplemented = data['teamsImplemented']; + this.currentActivity.teamsEvidence = this.defineEvidenceObject( + data['teamsEvidence'] + ); + // console.log("data['teamsEvidence']", data['teamsEvidence']); this.openall(); }); } @@ -309,6 +315,14 @@ export class ActivityDescriptionComponent implements OnInit { } } + defineEvidenceObject(dataToCheck: { [key: string]: string }): Object { + var dataToReturn: { [key: string]: string } = {}; + for (var key in dataToCheck) { + dataToReturn[key] = this.defineStringValues(dataToCheck[key], ''); + } + return dataToReturn; + } + defineImplementationObject(dataToCheck: implementation[]): implementation[] { var dataToReturn: implementation[] = []; for (var data in dataToCheck) {