Skip to content

Commit

Permalink
Removing usages of lintignore and fixing the underlying issue
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-glombik committed Oct 24, 2024
1 parent d592c52 commit 22c6a38
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h3 class="top-container flex-wrap flex-lg-nowrap">
<button
id="submit"
class="btn m-1 btn-success"
(click)="submit.emit(); sendSubmitAssessmentEventToAnalytics()"
(click)="onSubmit.emit(); sendSubmitAssessmentEventToAnalytics()"
[disabled]="submitDisabled"
[ngbTooltip]="('artemisApp.assessment.button.control' | artemisTranslate) + ' + Enter'"
>
Expand All @@ -127,7 +127,7 @@ <h3 class="top-container flex-wrap flex-lg-nowrap">
@if (!isTestRun) {
<button
class="btn m-1 btn-danger"
(click)="cancel.emit()"
(click)="onCancel.emit()"
[disabled]="!(exercise?.isAtLeastInstructor || isAssessor) || saveBusy || submitBusy || cancelBusy"
>
@if (cancelBusy) {
Expand All @@ -140,7 +140,7 @@ <h3 class="top-container flex-wrap flex-lg-nowrap">
@if (overrideVisible) {
<button
class="btn m-1 btn-danger"
(click)="submit.emit()"
(click)="onSubmit.emit()"
[disabled]="overrideDisabled"
[ngbTooltip]="('artemisApp.assessment.button.control' | artemisTranslate) + ' + Enter'"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ export class AssessmentHeaderComponent {
@Input() isProgrammingExercise = false; // remove once diff view activated for programming exercises

@Output() save = new EventEmitter<void>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() submit = new EventEmitter<void>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() cancel = new EventEmitter<void>();
@Output() onSubmit = new EventEmitter<void>();
@Output() onCancel = new EventEmitter<void>();
@Output() nextSubmission = new EventEmitter<void>();
@Output() highlightDifferencesChange = new EventEmitter<boolean>();
@Output() useAsExampleSubmission = new EventEmitter<void>();
Expand Down Expand Up @@ -143,9 +141,9 @@ export class AssessmentHeaderComponent {
submitOnControlAndEnter(event: KeyboardEvent) {
event.preventDefault();
if (!this.overrideDisabled) {
this.submit.emit();
this.onSubmit.emit();
} else if (!this.submitDisabled) {
this.submit.emit();
this.onSubmit.emit();
this.sendSubmitAssessmentEventToAnalytics();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
[correctionRound]="correctionRound"
[isProgrammingExercise]="isProgrammingExercise"
(save)="save.emit()"
(submit)="submit.emit()"
(cancel)="cancel.emit()"
(onSubmit)="onSubmit.emit()"
(onCancel)="onCancel.emit()"
[(highlightDifferences)]="highlightDifferences"
(nextSubmission)="nextSubmission.emit()"
[hasComplaint]="!!complaint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ export class AssessmentLayoutComponent {
}

@Output() save = new EventEmitter<void>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() submit = new EventEmitter<void>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() cancel = new EventEmitter<void>();
@Output() onSubmit = new EventEmitter<void>();
@Output() onCancel = new EventEmitter<void>();
@Output() nextSubmission = new EventEmitter<void>();
@Output() updateAssessmentAfterComplaint = new EventEmitter<AssessmentAfterComplaint>();
@Output() highlightDifferencesChange = new EventEmitter<boolean>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
[examId]="exam?.id!"
[complaintType]="formComplaintType"
[isCurrentUserSubmissionAuthor]="isCorrectUserToFileAction"
(submit)="loadPotentialComplaint()"
(onSubmit)="loadPotentialComplaint()"
/>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export class ComplaintsFormComponent implements OnInit {
@Input() examId?: number;
@Input() complaintType: ComplaintType;
@Input() isCurrentUserSubmissionAuthor = false;
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() submit: EventEmitter<void> = new EventEmitter();
@Output() onSubmit: EventEmitter<void> = new EventEmitter();
maxComplaintsPerCourse = 1;
maxComplaintTextLimit: number;
complaintText?: string;
Expand Down Expand Up @@ -63,7 +62,7 @@ export class ComplaintsFormComponent implements OnInit {

this.complaintService.create(complaintRequest).subscribe({
next: () => {
this.submit.emit();
this.onSubmit.emit();
},
error: (err: HttpErrorResponse) => {
if (err?.error?.errorKey === 'tooManyComplaints') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
[correctionRound]="correctionRound"
[(highlightDifferences)]="highlightDifferences"
(save)="onSaveAssessment()"
(submit)="onSubmitAssessment()"
(cancel)="onCancelAssessment()"
(onSubmit)="onSubmitAssessment()"
(onCancel)="onCancelAssessment()"
(nextSubmission)="assessNext()"
(updateAssessmentAfterComplaint)="onUpdateAssessmentAfterComplaint($event)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
[submission]="submission"
[hasAssessmentDueDatePassed]="hasAssessmentDueDatePassed"
(save)="onSaveAssessment()"
(submit)="onSubmitAssessment()"
(cancel)="onCancelAssessment()"
(onSubmit)="onSubmitAssessment()"
(onCancel)="onCancelAssessment()"
(nextSubmission)="assessNext()"
(updateAssessmentAfterComplaint)="onUpdateAssessmentAfterComplaint($event)"
[(highlightDifferences)]="highlightDifferences"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
[correctionRound]="correctionRound"
[isProgrammingExercise]="true"
(save)="save()"
(submit)="submit()"
(cancel)="cancel()"
(onSubmit)="submit()"
(onCancel)="cancel()"
(nextSubmission)="nextSubmission()"
(updateAssessmentAfterComplaint)="onUpdateAssessmentAfterComplaint($event)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
[hasAssessmentDueDatePassed]="hasAssessmentDueDatePassed"
[correctionRound]="correctionRound"
(save)="save()"
(submit)="submit()"
(cancel)="cancel()"
(onSubmit)="submit()"
(onCancel)="cancel()"
(nextSubmission)="nextSubmission()"
[(highlightDifferences)]="highlightDifferences"
(updateAssessmentAfterComplaint)="updateAssessmentAfterComplaint($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class="guided-tour-text-assessment"
(click)="select(false)"
(onFocus)="select(false)"
(close)="unselect()"
(onClose)="unselect()"
(feedbackChange)="feedbackDidChange()"
[readOnly]="readOnly"
[highlightDifferences]="highlightDifferences"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export class TextblockFeedbackEditorComponent implements AfterViewInit {
@Input() textBlock: TextBlock = new TextBlock();
@Input() feedback: Feedback = new Feedback();
@Output() feedbackChange = new EventEmitter<Feedback>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() close = new EventEmitter<void>();
@Output() onClose = new EventEmitter<void>();
@Output() onFocus = new EventEmitter<void>();
@ViewChild('detailText') textareaRef: ElementRef;
@ViewChild(ConfirmIconComponent) confirmIconComponent: ConfirmIconComponent;
Expand Down Expand Up @@ -96,7 +95,7 @@ export class TextblockFeedbackEditorComponent implements AfterViewInit {
* Dismiss changes in feedback editor
*/
dismiss(): void {
this.close.emit();
this.onClose.emit();
this.textAssessmentAnalytics.sendAssessmentEvent(TextAssessmentEventType.DELETE_FEEDBACK, this.feedback.type, this.textBlock.type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ describe('AssessmentHeaderComponent', () => {
saveButtonSpan.nativeElement.click();
expect(component.save.emit).toHaveBeenCalledOnce();

jest.spyOn(component.submit, 'emit');
jest.spyOn(component.onSubmit, 'emit');
submitButtonSpan.nativeElement.click();
expect(component.submit.emit).toHaveBeenCalledOnce();
expect(component.onSubmit.emit).toHaveBeenCalledOnce();

const cancelButtonSpan = fixture.debugElement.query(By.css('[jhiTranslate$=cancel]'));
jest.spyOn(component.cancel, 'emit');
jest.spyOn(component.onCancel, 'emit');
cancelButtonSpan.nativeElement.click();
expect(component.cancel.emit).toHaveBeenCalledOnce();
expect(component.onCancel.emit).toHaveBeenCalledOnce();
});

it('should show override button when result is present', () => {
Expand All @@ -189,9 +189,9 @@ describe('AssessmentHeaderComponent', () => {
overrideAssessmentButtonSpan = fixture.debugElement.query(By.css('[jhiTranslate$=overrideAssessment]'));
expect(overrideAssessmentButtonSpan).toBeTruthy();

jest.spyOn(component.submit, 'emit');
jest.spyOn(component.onSubmit, 'emit');
overrideAssessmentButtonSpan.nativeElement.click();
expect(component.submit.emit).toHaveBeenCalledOnce();
expect(component.onSubmit.emit).toHaveBeenCalledOnce();
});

it('should show next submission if assessor or instructor, result is present and no complaint', () => {
Expand Down Expand Up @@ -345,7 +345,7 @@ describe('AssessmentHeaderComponent', () => {

const eventMock = new KeyboardEvent('keydown', { ctrlKey: true, key: 'Enter' });
const spyOnControlAndEnter = jest.spyOn(component, 'submitOnControlAndEnter');
const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
document.dispatchEvent(eventMock);

expect(spyOnControlAndEnter).toHaveBeenCalledOnce();
Expand All @@ -362,7 +362,7 @@ describe('AssessmentHeaderComponent', () => {

const eventMock = new KeyboardEvent('keydown', { ctrlKey: true, key: 'Enter' });
const spyOnControlAndEnter = jest.spyOn(component, 'submitOnControlAndEnter');
const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
document.dispatchEvent(eventMock);

expect(spyOnControlAndEnter).toHaveBeenCalledOnce();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('ComplaintsFormComponent', () => {

it('should submit after complaint creation', () => {
const createMock = jest.spyOn(complaintService, 'create').mockReturnValue(of({} as EntityResponseType));
const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
component.createComplaint();
expect(createMock).toHaveBeenCalledOnce();
expect(submitSpy).toHaveBeenCalledOnce();
Expand All @@ -93,7 +93,7 @@ describe('ComplaintsFormComponent', () => {

it('should throw unknown error after complaint creation', () => {
const createMock = jest.spyOn(complaintService, 'create').mockReturnValue(throwError(() => ({ status: 400 })));
const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
const errorSpy = jest.spyOn(alertService, 'error');
component.createComplaint();
expect(createMock).toHaveBeenCalledOnce();
Expand All @@ -104,7 +104,7 @@ describe('ComplaintsFormComponent', () => {
it('should throw known error after complaint creation', () => {
const error = { error: { errorKey: 'tooManyComplaints' } } as HttpErrorResponse;
const createMock = jest.spyOn(complaintService, 'create').mockReturnValue(throwError(() => error));
const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
const errorSpy = jest.spyOn(alertService, 'error');
const numberOfComplaints = 42;
component.maxComplaintsPerCourse = numberOfComplaints;
Expand All @@ -120,7 +120,7 @@ describe('ComplaintsFormComponent', () => {
component.exercise = courseExercise;
component.ngOnInit();

const submitSpy = jest.spyOn(component.submit, 'emit');
const submitSpy = jest.spyOn(component.onSubmit, 'emit');
const errorSpy = jest.spyOn(alertService, 'error');
// 26 characters
component.complaintText = 'abcdefghijklmnopqrstuvwxyz';
Expand Down

0 comments on commit 22c6a38

Please sign in to comment.