Skip to content

Commit

Permalink
fix testsetup of error compoennet
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jan 14, 2025
1 parent 8bac815 commit db773cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
11 changes: 10 additions & 1 deletion frontend/src/app/shared/custom/error/error.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ErrorComponent } from './error.component';
import { TranslateTestingModule } from 'ngx-translate-testing';
// @ts-ignore
import * as de from '../../../../assets/i18n/de.json';
import { TranslateModule, TranslateService } from '@ngx-translate/core';

describe('ErrorComponent', () => {
let component: ErrorComponent;
let fixture: ComponentFixture<ErrorComponent>;

beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ErrorComponent]
declarations: [ErrorComponent],
providers: [TranslateService],
imports: [TranslateModule.forRoot(),
TranslateTestingModule.withTranslations({
de: de
})]
})
.compileComponents();

Expand Down
7 changes: 2 additions & 5 deletions frontend/src/app/shared/custom/error/error.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Component, Input } from '@angular/core';
import { MatError } from '@angular/material/form-field';
import { NgForOf } from '@angular/common';
import { FormGroup, ValidationErrors } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';

@Component({
selector: 'app-error',
imports: [MatError,
NgForOf],
templateUrl: './error.component.html',
styleUrl: './error.component.scss'
styleUrl: './error.component.scss',
standalone: false
})
export class ErrorComponent {
@Input() form?: FormGroup;
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { DialogTemplateCoreComponent } from './custom/dialog-template-core/dialo
import { MatDividerModule } from '@angular/material/divider';
import { UnitTransformationPipe } from './pipes/unit-transformation/unit-transformation.pipe';
import { MatTooltip } from '@angular/material/tooltip';
import { ErrorComponent } from './custom/error/error.component';

@NgModule({
declarations: [
Expand All @@ -35,7 +36,8 @@ import { MatTooltip } from '@angular/material/tooltip';
OkrTangramComponent,
SidePanelComponent,
SpinnerComponent,
DialogTemplateCoreComponent
DialogTemplateCoreComponent,
ErrorComponent
],
imports: [
CommonModule,
Expand Down Expand Up @@ -68,7 +70,9 @@ import { MatTooltip } from '@angular/material/tooltip';
UnitTransformationPipe,
SidePanelComponent,
SpinnerComponent,
DialogTemplateCoreComponent
DialogTemplateCoreComponent,
ErrorComponent

]
})
export class SharedModule {}

0 comments on commit db773cf

Please sign in to comment.