From 7e921e6b7a061e2fb4c6ea47c554af8eccbf82bc Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 21 Nov 2024 12:48:00 +0100 Subject: [PATCH 01/11] highlight selected result --- .../text/participate/text-editor.component.html | 2 +- .../result-history/result-history.component.html | 10 +++++++++- .../result-history/result-history.component.ts | 1 + .../app/overview/result-history/result-history.scss | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/exercises/text/participate/text-editor.component.html b/src/main/webapp/app/exercises/text/participate/text-editor.component.html index c070d57e29ea..6794a0d0f9ab 100644 --- a/src/main/webapp/app/exercises/text/participate/text-editor.component.html +++ b/src/main/webapp/app/exercises/text/participate/text-editor.component.html @@ -54,7 +54,7 @@ @if (isReadOnlyWithShowResult) { @if (showHistory) {
- +
} } diff --git a/src/main/webapp/app/overview/result-history/result-history.component.html b/src/main/webapp/app/overview/result-history/result-history.component.html index cfa6cdbb897e..c13d7347b01a 100644 --- a/src/main/webapp/app/overview/result-history/result-history.component.html +++ b/src/main/webapp/app/overview/result-history/result-history.component.html @@ -5,7 +5,15 @@ @for (result of displayedResults; track result; let i = $index) {
-
+
+ >
Date: Thu, 21 Nov 2024 13:11:44 +0100 Subject: [PATCH 02/11] typo --- .../app/overview/result-history/result-history.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/app/overview/result-history/result-history.component.html b/src/main/webapp/app/overview/result-history/result-history.component.html index c13d7347b01a..429451b99073 100644 --- a/src/main/webapp/app/overview/result-history/result-history.component.html +++ b/src/main/webapp/app/overview/result-history/result-history.component.html @@ -13,7 +13,6 @@ : getTextColorClass(result, evaluateTemplateStatus(exercise, result.participation, result, false, MissingResultInfo.NONE)) " > - >
Date: Thu, 21 Nov 2024 13:15:09 +0100 Subject: [PATCH 03/11] royal blue --- src/main/webapp/app/overview/result-history/result-history.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/overview/result-history/result-history.scss b/src/main/webapp/app/overview/result-history/result-history.scss index 315dc3442554..fd9e2331ecfc 100644 --- a/src/main/webapp/app/overview/result-history/result-history.scss +++ b/src/main/webapp/app/overview/result-history/result-history.scss @@ -21,7 +21,7 @@ $result-icon-size: 25px; background-color: transparent; &.selected-icon fa-icon { - color: turquoise; + color: royalblue; } } From bf87ed1008d4dce66cc9c05703a436782ab52dab Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 21 Nov 2024 13:32:23 +0100 Subject: [PATCH 04/11] client theme guidelines, use primary color --- .../app/overview/result-history/result-history.component.html | 2 +- .../webapp/app/overview/result-history/result-history.scss | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/webapp/app/overview/result-history/result-history.component.html b/src/main/webapp/app/overview/result-history/result-history.component.html index 429451b99073..4b9642d361c2 100644 --- a/src/main/webapp/app/overview/result-history/result-history.component.html +++ b/src/main/webapp/app/overview/result-history/result-history.component.html @@ -9,7 +9,7 @@ class="result-score-icon" [ngClass]=" result.id === selectedResultId - ? 'selected-icon' + ? 'text-primary' : getTextColorClass(result, evaluateTemplateStatus(exercise, result.participation, result, false, MissingResultInfo.NONE)) " > diff --git a/src/main/webapp/app/overview/result-history/result-history.scss b/src/main/webapp/app/overview/result-history/result-history.scss index fd9e2331ecfc..8241f7406c6b 100644 --- a/src/main/webapp/app/overview/result-history/result-history.scss +++ b/src/main/webapp/app/overview/result-history/result-history.scss @@ -19,10 +19,6 @@ $result-icon-size: 25px; height: $result-icon-size; border-radius: $result-icon-size; background-color: transparent; - - &.selected-icon fa-icon { - color: royalblue; - } } .result-score-info { From 315942d91a6d2191df2eb5a9e6843f4991654ddb Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 28 Nov 2024 16:32:48 +0100 Subject: [PATCH 05/11] text editor use signals --- .../participate/text-editor.component.html | 10 +++--- .../text/participate/text-editor.component.ts | 33 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/webapp/app/exercises/text/participate/text-editor.component.html b/src/main/webapp/app/exercises/text/participate/text-editor.component.html index 6794a0d0f9ab..c240142e10c2 100644 --- a/src/main/webapp/app/exercises/text/participate/text-editor.component.html +++ b/src/main/webapp/app/exercises/text/participate/text-editor.component.html @@ -1,5 +1,5 @@
- @if (displayHeader) { + @if (displayHeader()) { {{ 'artemisApp.textSubmission.textEditor' | artemisTranslate }}: @@ -64,7 +64,7 @@ @if (textExercise) { @@ -79,7 +79,7 @@ @@ -87,7 +87,7 @@ @@ -104,7 +104,7 @@ [disabled]="!isActive || !submission || !isOwnerOfParticipation" (keydown.tab)="onTextEditorTab(textEditor, $event)" (input)="onTextEditorInput($event)" - [hidden]="submission && !submission.submitted && isExamSummary" + [hidden]="submission && !submission.submitted && isExamSummary()" > @if (textExercise?.teamMode) { (); + displayHeader = input(true); + expandProblemStatement = input(true); + inputExercise = input(); + inputSubmission = input(); + inputParticipation = input(); + isExamSummary = input(false); textExercise: TextExercise; participation: StudentParticipation; @@ -109,7 +108,7 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact if (this.inputValuesArePresent()) { this.setupComponentWithInputValues(); } else { - const participationId = this.participationId !== undefined ? this.participationId : Number(this.route.snapshot.paramMap.get('participationId')); + const participationId = this.participationId() !== undefined ? this.participationId() : Number(this.route.snapshot.paramMap.get('participationId()')); this.submissionId = Number(this.route.snapshot.paramMap.get('submissionId')) || undefined; if (Number.isNaN(participationId)) { @@ -163,7 +162,7 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact } private inputValuesArePresent(): boolean { - return !!(this.inputExercise || this.inputSubmission || this.inputParticipation); + return !!(this.inputExercise() || this.inputSubmission() || this.inputParticipation()); } /** @@ -174,14 +173,14 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact * @private */ private setupComponentWithInputValues() { - if (this.inputExercise) { - this.textExercise = this.inputExercise; + if (this.inputExercise()) { + this.textExercise = this.inputExercise(); } - if (this.inputSubmission) { - this.submission = this.inputSubmission; + if (this.inputSubmission()) { + this.submission = this.inputSubmission(); } - if (this.inputParticipation) { - this.participation = this.inputParticipation; + if (this.inputParticipation()) { + this.participation = this.inputParticipation(); } if (this.submission?.text) { From 4fe7f91a6901b6b37463df77d94ba986353c5c9a Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 28 Nov 2024 16:50:19 +0100 Subject: [PATCH 06/11] handle signals properly --- .../text/participate/text-editor.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/app/exercises/text/participate/text-editor.component.ts b/src/main/webapp/app/exercises/text/participate/text-editor.component.ts index 6e91af4d8ef3..fb82c10773a8 100644 --- a/src/main/webapp/app/exercises/text/participate/text-editor.component.ts +++ b/src/main/webapp/app/exercises/text/participate/text-editor.component.ts @@ -108,7 +108,7 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact if (this.inputValuesArePresent()) { this.setupComponentWithInputValues(); } else { - const participationId = this.participationId() !== undefined ? this.participationId() : Number(this.route.snapshot.paramMap.get('participationId()')); + const participationId = this.participationId() !== undefined ? this.participationId() : Number(this.route.snapshot.paramMap.get('participationId')); this.submissionId = Number(this.route.snapshot.paramMap.get('submissionId')) || undefined; if (Number.isNaN(participationId)) { @@ -120,7 +120,7 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact this.updateParticipation(this.participation, this.submissionId); }); - this.textService.get(participationId).subscribe({ + this.textService.get(participationId!).subscribe({ next: (data: StudentParticipation) => this.updateParticipation(data, this.submissionId), error: (error: HttpErrorResponse) => onError(this.alertService, error), }); @@ -173,14 +173,14 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact * @private */ private setupComponentWithInputValues() { - if (this.inputExercise()) { - this.textExercise = this.inputExercise(); + if (this.inputExercise() !== undefined) { + this.textExercise = this.inputExercise()!; } - if (this.inputSubmission()) { - this.submission = this.inputSubmission(); + if (this.inputSubmission() !== undefined) { + this.submission = this.inputSubmission()!; } - if (this.inputParticipation()) { - this.participation = this.inputParticipation(); + if (this.inputParticipation() !== undefined) { + this.participation = this.inputParticipation()!; } if (this.submission?.text) { From c9e222044d873730b9adb8e72cc8eb93f1387505 Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 28 Nov 2024 17:07:24 +0100 Subject: [PATCH 07/11] signals in result history component. fix text editor tests --- .../text/participate/text-editor.component.ts | 2 +- .../result-history.component.html | 8 ++++---- .../result-history.component.ts | 20 ++++++++++--------- .../text-editor/text-editor.component.spec.ts | 6 +++--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/webapp/app/exercises/text/participate/text-editor.component.ts b/src/main/webapp/app/exercises/text/participate/text-editor.component.ts index fb82c10773a8..559917a03268 100644 --- a/src/main/webapp/app/exercises/text/participate/text-editor.component.ts +++ b/src/main/webapp/app/exercises/text/participate/text-editor.component.ts @@ -60,7 +60,7 @@ export class TextEditorComponent implements OnInit, OnDestroy, ComponentCanDeact participationId = input(); displayHeader = input(true); - expandProblemStatement = input(true); + expandProblemStatement = input(true); inputExercise = input(); inputSubmission = input(); inputParticipation = input(); diff --git a/src/main/webapp/app/overview/result-history/result-history.component.html b/src/main/webapp/app/overview/result-history/result-history.component.html index 4b9642d361c2..3748b2755790 100644 --- a/src/main/webapp/app/overview/result-history/result-history.component.html +++ b/src/main/webapp/app/overview/result-history/result-history.component.html @@ -8,16 +8,16 @@
- +
(); + exercise = input(); + selectedResultId = input(); showPreviousDivider = false; displayedResults: Result[]; movedLastRatedResult: boolean; ngOnChanges(): void { - this.showPreviousDivider = this.results.length > MAX_RESULT_HISTORY_LENGTH; - if (this.exercise?.type === ExerciseType.TEXT || this.exercise?.type === ExerciseType.MODELING) { - this.displayedResults = this.results.filter((result) => result.successful !== undefined); + this.showPreviousDivider = this.results().length > MAX_RESULT_HISTORY_LENGTH; + if (this.exercise()?.type === ExerciseType.TEXT || this.exercise()?.type === ExerciseType.MODELING) { + this.displayedResults = this.results().filter((result) => result.successful !== undefined); } else { - this.displayedResults = this.results; + this.displayedResults = this.results(); } const successfulResultsLength = this.displayedResults.length; if (successfulResultsLength > MAX_RESULT_HISTORY_LENGTH) { this.displayedResults = this.displayedResults.slice(successfulResultsLength - MAX_RESULT_HISTORY_LENGTH); - const lastRatedResult = this.results.filter((result) => result.rated).last(); + const lastRatedResult = this.results() + .filter((result) => result.rated) + .last(); if (!this.displayedResults.first()?.rated && lastRatedResult) { this.displayedResults[0] = lastRatedResult; this.movedLastRatedResult = true; diff --git a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts index 0f65d8bc2ef3..4af4e2d2c4fc 100644 --- a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts +++ b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts @@ -110,9 +110,9 @@ describe('TextEditorComponent', () => { }); it('should use inputValues if present instead of loading new details', fakeAsync(() => { - comp.inputExercise = textExercise; - comp.inputParticipation = participation; - comp.inputSubmission = { id: 1, text: 'test' }; + comp.inputExercise = signal(textExercise); + comp.inputParticipation = signal(participation); + comp.inputSubmission = signal({ id: 1, text: 'test' }); // @ts-ignore updateParticipation is private const updateParticipationSpy = jest.spyOn(comp, 'updateParticipation'); // @ts-ignore setupComponentWithInputValuesSpy is private From 42932caee2674b2fbc0fa5b60a80c41670a1835a Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Thu, 28 Nov 2024 17:19:52 +0100 Subject: [PATCH 08/11] result history component tests --- .../result-history.component.spec.ts | 18 ++++++++++-------- .../text-editor/text-editor.component.spec.ts | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts index 8c5333322db6..9e34af55d71f 100644 --- a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts +++ b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts @@ -1,8 +1,10 @@ +import { input } from '@angular/core"'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ResultHistoryComponent } from 'app/overview/result-history/result-history.component'; import { MockPipe } from 'ng-mocks'; import { ArtemisDatePipe } from 'app/shared/pipes/artemis-date.pipe'; import { ArtemisTestModule } from '../../../test.module'; +import { Result } from 'app/entities/result.model'; describe('ResultHistoryComponent', () => { let component: ResultHistoryComponent; @@ -25,11 +27,11 @@ describe('ResultHistoryComponent', () => { }); it('should initialize with same rated results', () => { - component.results = [ + component.results = input([ { rated: true, id: 1 }, { rated: true, id: 2 }, { rated: true, id: 3 }, - ]; + ]); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 }, @@ -39,14 +41,14 @@ describe('ResultHistoryComponent', () => { expect(component.showPreviousDivider).toBeFalse(); expect(component.movedLastRatedResult).toBeFalsy(); - component.results = [ + component.results = input([ { rated: false, id: 1 }, { rated: false, id: 2 }, { rated: false, id: 3 }, { rated: false, id: 4 }, { rated: false, id: 5 }, { rated: false, id: 6 }, - ]; + ]); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: false, id: 2 }, @@ -60,11 +62,11 @@ describe('ResultHistoryComponent', () => { }); it('should initialize with mixed rated results', () => { - component.results = [ + component.results = input([ { rated: true, id: 1 }, { rated: false, id: 2 }, { rated: false, id: 3 }, - ]; + ]); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 }, @@ -74,14 +76,14 @@ describe('ResultHistoryComponent', () => { expect(component.showPreviousDivider).toBeFalse(); expect(component.movedLastRatedResult).toBeFalsy(); - component.results = [ + component.results = input([ { rated: true, id: 1 }, { rated: false, id: 2 }, { rated: false, id: 3 }, { rated: false, id: 4 }, { rated: false, id: 5 }, { rated: false, id: 6 }, - ]; + ]); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 }, diff --git a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts index 4af4e2d2c4fc..aa901f579e2f 100644 --- a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts +++ b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts @@ -1,4 +1,4 @@ -import { DebugElement } from '@angular/core'; +import { DebugElement, input } from '@angular/core'; import dayjs from 'dayjs/esm'; import { ActivatedRoute, RouterModule, convertToParamMap } from '@angular/router'; import { ComponentFixture, TestBed, fakeAsync, flush, tick } from '@angular/core/testing'; @@ -110,9 +110,9 @@ describe('TextEditorComponent', () => { }); it('should use inputValues if present instead of loading new details', fakeAsync(() => { - comp.inputExercise = signal(textExercise); - comp.inputParticipation = signal(participation); - comp.inputSubmission = signal({ id: 1, text: 'test' }); + comp.inputExercise = input(textExercise); + comp.inputParticipation = input(participation); + comp.inputSubmission = input({ id: 1, text: 'test' }); // @ts-ignore updateParticipation is private const updateParticipationSpy = jest.spyOn(comp, 'updateParticipation'); // @ts-ignore setupComponentWithInputValuesSpy is private From f2a6596879802122470402da97474b3868d01c9e Mon Sep 17 00:00:00 2001 From: Enea Gore <73840596+EneaGore@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:26:56 +0100 Subject: [PATCH 09/11] typo --- .../overview/result-history/result-history.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts index 9e34af55d71f..3cadfb708ff4 100644 --- a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts +++ b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts @@ -1,4 +1,4 @@ -import { input } from '@angular/core"'; +import { input } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ResultHistoryComponent } from 'app/overview/result-history/result-history.component'; import { MockPipe } from 'ng-mocks'; From 8fb92bba152cc906e10bcfab93ecbafd92974897 Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Fri, 29 Nov 2024 12:42:39 +0100 Subject: [PATCH 10/11] use injection context in tests --- .../result-history.component.spec.ts | 44 +++++++++++-------- .../text-editor/text-editor.component.spec.ts | 10 +++-- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts index 3cadfb708ff4..25daca3b9e13 100644 --- a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts +++ b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts @@ -1,4 +1,4 @@ -import { input } from '@angular/core'; +import { input, runInInjectionContext } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ResultHistoryComponent } from 'app/overview/result-history/result-history.component'; import { MockPipe } from 'ng-mocks'; @@ -27,11 +27,13 @@ describe('ResultHistoryComponent', () => { }); it('should initialize with same rated results', () => { - component.results = input([ - { rated: true, id: 1 }, - { rated: true, id: 2 }, - { rated: true, id: 3 }, - ]); + runInInjectionContext(TestBed, () => { + component.results = input([ + { rated: true, id: 1 }, + { rated: true, id: 2 }, + { rated: true, id: 3 }, + ]); + }); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 }, @@ -41,14 +43,16 @@ describe('ResultHistoryComponent', () => { expect(component.showPreviousDivider).toBeFalse(); expect(component.movedLastRatedResult).toBeFalsy(); - component.results = input([ - { rated: false, id: 1 }, - { rated: false, id: 2 }, - { rated: false, id: 3 }, - { rated: false, id: 4 }, - { rated: false, id: 5 }, - { rated: false, id: 6 }, - ]); + runInInjectionContext(TestBed, () => { + component.results = input([ + { rated: false, id: 1 }, + { rated: false, id: 2 }, + { rated: false, id: 3 }, + { rated: false, id: 4 }, + { rated: false, id: 5 }, + { rated: false, id: 6 }, + ]); + }); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: false, id: 2 }, @@ -62,11 +66,13 @@ describe('ResultHistoryComponent', () => { }); it('should initialize with mixed rated results', () => { - component.results = input([ - { rated: true, id: 1 }, - { rated: false, id: 2 }, - { rated: false, id: 3 }, - ]); + runInInjectionContext(TestBed, () => { + component.results = input([ + { rated: true, id: 1 }, + { rated: false, id: 2 }, + { rated: false, id: 3 }, + ]); + }); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 }, diff --git a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts index aa901f579e2f..47902e658500 100644 --- a/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts +++ b/src/test/javascript/spec/component/text-editor/text-editor.component.spec.ts @@ -1,4 +1,4 @@ -import { DebugElement, input } from '@angular/core'; +import { DebugElement, input, runInInjectionContext } from '@angular/core'; import dayjs from 'dayjs/esm'; import { ActivatedRoute, RouterModule, convertToParamMap } from '@angular/router'; import { ComponentFixture, TestBed, fakeAsync, flush, tick } from '@angular/core/testing'; @@ -110,9 +110,11 @@ describe('TextEditorComponent', () => { }); it('should use inputValues if present instead of loading new details', fakeAsync(() => { - comp.inputExercise = input(textExercise); - comp.inputParticipation = input(participation); - comp.inputSubmission = input({ id: 1, text: 'test' }); + runInInjectionContext(TestBed, () => { + comp.inputExercise = input(textExercise); + comp.inputParticipation = input(participation); + comp.inputSubmission = input({ id: 1, text: 'test' }); + }); // @ts-ignore updateParticipation is private const updateParticipationSpy = jest.spyOn(comp, 'updateParticipation'); // @ts-ignore setupComponentWithInputValuesSpy is private From c8a814089644040d464a012f7accb1474b336a21 Mon Sep 17 00:00:00 2001 From: = Enea_Gore Date: Fri, 29 Nov 2024 12:50:31 +0100 Subject: [PATCH 11/11] use injection context in result history tests --- .../result-history.component.spec.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts index 25daca3b9e13..b5746f24e492 100644 --- a/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts +++ b/src/test/javascript/spec/component/overview/result-history/result-history.component.spec.ts @@ -82,14 +82,16 @@ describe('ResultHistoryComponent', () => { expect(component.showPreviousDivider).toBeFalse(); expect(component.movedLastRatedResult).toBeFalsy(); - component.results = input([ - { rated: true, id: 1 }, - { rated: false, id: 2 }, - { rated: false, id: 3 }, - { rated: false, id: 4 }, - { rated: false, id: 5 }, - { rated: false, id: 6 }, - ]); + runInInjectionContext(TestBed, () => { + component.results = input([ + { rated: true, id: 1 }, + { rated: false, id: 2 }, + { rated: false, id: 3 }, + { rated: false, id: 4 }, + { rated: false, id: 5 }, + { rated: false, id: 6 }, + ]); + }); component.ngOnChanges(); expect(component.displayedResults).toEqual([ { rated: true, id: 1 },