From f588a0016b18e966580e056d1ca0280bedc89380 Mon Sep 17 00:00:00 2001 From: EgeDoguKaya Date: Sat, 26 Oct 2024 18:23:31 +0200 Subject: [PATCH] add triggersave test to modeling test --- .../exercises/modeling-exam-submission.component.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/javascript/spec/component/exam/participate/exercises/modeling-exam-submission.component.spec.ts b/src/test/javascript/spec/component/exam/participate/exercises/modeling-exam-submission.component.spec.ts index 00bf29cf60e3..5b2845a76b22 100644 --- a/src/test/javascript/spec/component/exam/participate/exercises/modeling-exam-submission.component.spec.ts +++ b/src/test/javascript/spec/component/exam/participate/exercises/modeling-exam-submission.component.spec.ts @@ -104,6 +104,14 @@ describe('ModelingExamSubmissionComponent', () => { expect(directiveInstance.translateValues).toEqual({ points: maxScore, bonusPoints: bonusPoints }); }); + it('should call triggerSave if save exercise button is clicked', () => { + fixture.detectChanges(); + const saveExerciseSpy = jest.spyOn(comp, 'notifyTriggerSave'); + const saveButton = fixture.debugElement.query(By.directive(ExerciseSaveButtonComponent)); + saveButton.triggerEventHandler('save', null); + expect(saveExerciseSpy).toHaveBeenCalledOnce(); + }); + it('should show modeling editor with correct props when there is submission and exercise', () => { fixture.detectChanges(); const modelingEditor = fixture.debugElement.query(By.directive(ModelingEditorComponent));