From 4ad7aac9b9b1ff6d3f708157afe5d2b550fb8d95 Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Wed, 8 Nov 2023 04:51:59 +0100 Subject: [PATCH 1/3] Do not display timer for unsubmitted exam --- .../exam-cover/exam-participation-cover.component.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/exam/participate/exam-cover/exam-participation-cover.component.html b/src/main/webapp/app/exam/participate/exam-cover/exam-participation-cover.component.html index 695cc2e5335e..d308dc4ce6ea 100644 --- a/src/main/webapp/app/exam/participate/exam-cover/exam-participation-cover.component.html +++ b/src/main/webapp/app/exam/participate/exam-cover/exam-participation-cover.component.html @@ -20,7 +20,13 @@

+
From 7af506d38f8720ca7c9119a30bec4d8f7c19e7b6 Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Wed, 8 Nov 2023 05:24:03 +0100 Subject: [PATCH 2/3] Adding tests whether timer is displayed --- ...m-exercise-overview-page.component.spec.ts | 2 +- ...exam-participation-cover.component.spec.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/test/javascript/spec/component/exam/participate/exam-exercise-overview-page.component.spec.ts b/src/test/javascript/spec/component/exam/participate/exam-exercise-overview-page.component.spec.ts index 307a80313115..ef6d2b7aac02 100644 --- a/src/test/javascript/spec/component/exam/participate/exam-exercise-overview-page.component.spec.ts +++ b/src/test/javascript/spec/component/exam/participate/exam-exercise-overview-page.component.spec.ts @@ -14,7 +14,7 @@ import { StudentExam } from 'app/entities/student-exam.model'; import { TranslateService } from '@ngx-translate/core'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; -describe('Exam Exercise Overview Component', () => { +describe('ExamExerciseOverviewPageComponent', () => { let fixture: ComponentFixture; let comp: ExamExerciseOverviewPageComponent; diff --git a/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts b/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts index 5da31fcc0a43..8c5238fcf608 100644 --- a/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts +++ b/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts @@ -30,6 +30,7 @@ import { MockAccountService } from '../../../helpers/mocks/service/mock-account. import { MockExamParticipationService } from '../../../helpers/mocks/service/mock-exam-participation.service'; import { MockArtemisServerDateService } from '../../../helpers/mocks/service/mock-server-date.service'; import { ExamLiveEventsButtonComponent } from 'app/exam/participate/events/exam-live-events-button.component'; +import { By } from '@angular/platform-browser'; describe('ExamParticipationCoverComponent', () => { const course = { id: 456 } as Course; @@ -334,4 +335,24 @@ describe('ExamParticipationCoverComponent', () => { component.studentExam.submitted = false; expect(component.studentFailedToSubmit).toBeFalse(); }); + + it('should not display timer when exam was not submitted', () => { + jest.spyOn(component, 'studentFailedToSubmit', 'get').mockReturnValue(true); + component.startView = false; + + fixture.detectChanges(); + + const examTimerDebugElement = fixture.debugElement.query(By.directive(ExamTimerComponent)); + expect(examTimerDebugElement).toBeFalsy(); + }); + + it('should display timer during working time', () => { + jest.spyOn(component, 'studentFailedToSubmit', 'get').mockReturnValue(false); + component.startView = false; + + fixture.detectChanges(); + + const examTimerDebugElement = fixture.debugElement.query(By.directive(ExamTimerComponent)); // Replace with the actual component class name + expect(examTimerDebugElement).toBeTruthy(); + }); }); From 0f5742ae424f0cecce9f9ade6f8a5fd8d89c96a0 Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Wed, 8 Nov 2023 15:43:21 +0100 Subject: [PATCH 3/3] Removing not needed comment --- .../exam/participate/exam-participation-cover.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts b/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts index 8c5238fcf608..0e06ecf428a6 100644 --- a/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts +++ b/src/test/javascript/spec/component/exam/participate/exam-participation-cover.component.spec.ts @@ -352,7 +352,7 @@ describe('ExamParticipationCoverComponent', () => { fixture.detectChanges(); - const examTimerDebugElement = fixture.debugElement.query(By.directive(ExamTimerComponent)); // Replace with the actual component class name + const examTimerDebugElement = fixture.debugElement.query(By.directive(ExamTimerComponent)); expect(examTimerDebugElement).toBeTruthy(); }); });