From 3220671f26e463449136c1620c96a88bfb6784d0 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Fri, 21 Sep 2018 09:32:05 -0700 Subject: [PATCH] SHIBUI-814 Fixed tests --- .../component/i18n-text.component.html | 0 .../component/i18n-text.component.ts | 0 .../component/translate.component.spec.ts | 5 +- .../directive/translate.directive.spec.ts | 75 +++++++++++++++++++ ui/src/app/i18n/i18n.module.ts | 4 +- ui/src/app/i18n/pipe/i18n.pipe.spec.ts | 7 +- .../forms/assertion-form.component.spec.ts | 1 - .../descriptor-info-form.component.spec.ts | 1 - .../forms/finish-form.component.spec.ts | 2 - .../forms/key-info-form.component.spec.ts | 4 +- .../forms/logout-form.component.spec.ts | 4 +- .../forms/metadata-ui-form.component.spec.ts | 4 +- .../organization-info-form.component.spec.ts | 1 - .../relying-party-form.component.spec.ts | 1 - .../provider-editor-nav.component.spec.ts | 2 - .../container/provider-edit.component.spec.ts | 4 +- .../provider-filter-list.component.spec.ts | 6 +- .../provider-wizard.component.spec.ts | 4 +- .../container/copy-resolver.component.spec.ts | 1 - .../container/copy-resolver.component.ts | 7 +- .../container/new-resolver.component.spec.ts | 1 - ui/src/app/shared/shared.module.ts | 3 - ui/src/testing/i18n.stub.ts | 14 +++- 23 files changed, 112 insertions(+), 39 deletions(-) rename ui/src/app/{shared => i18n}/component/i18n-text.component.html (100%) rename ui/src/app/{shared => i18n}/component/i18n-text.component.ts (100%) create mode 100644 ui/src/app/i18n/directive/translate.directive.spec.ts diff --git a/ui/src/app/shared/component/i18n-text.component.html b/ui/src/app/i18n/component/i18n-text.component.html similarity index 100% rename from ui/src/app/shared/component/i18n-text.component.html rename to ui/src/app/i18n/component/i18n-text.component.html diff --git a/ui/src/app/shared/component/i18n-text.component.ts b/ui/src/app/i18n/component/i18n-text.component.ts similarity index 100% rename from ui/src/app/shared/component/i18n-text.component.ts rename to ui/src/app/i18n/component/i18n-text.component.ts diff --git a/ui/src/app/i18n/component/translate.component.spec.ts b/ui/src/app/i18n/component/translate.component.spec.ts index a99754153..e28e232ac 100644 --- a/ui/src/app/i18n/component/translate.component.spec.ts +++ b/ui/src/app/i18n/component/translate.component.spec.ts @@ -30,6 +30,7 @@ describe('Component: I18n translation', () => { let fixture: ComponentFixture; let instance: TestHostComponent; let store: Store; + let service: I18nService; const msg = { foo: 'foo', @@ -45,7 +46,7 @@ describe('Component: I18n translation', () => { imports: [ CommonModule, StoreModule.forRoot({ - 'message': combineReducers(fromI18n.reducers), + 'i18n': combineReducers(fromI18n.reducers), }) ], declarations: [ @@ -54,6 +55,7 @@ describe('Component: I18n translation', () => { ], }); store = TestBed.get(Store); + service = TestBed.get(I18nService); spyOn(store, 'dispatch').and.callThrough(); @@ -62,6 +64,7 @@ describe('Component: I18n translation', () => { }); it('should set the correct text', () => { + spyOn(service, 'translate').and.returnValue('foo'); store.dispatch(new MessagesLoadSuccessAction(msg)); store.select(fromI18n.getMessages).subscribe(() => { diff --git a/ui/src/app/i18n/directive/translate.directive.spec.ts b/ui/src/app/i18n/directive/translate.directive.spec.ts new file mode 100644 index 000000000..d9e04f4b7 --- /dev/null +++ b/ui/src/app/i18n/directive/translate.directive.spec.ts @@ -0,0 +1,75 @@ +import { I18nService } from '../service/i18n.service'; +import { CommonModule } from '@angular/common'; +import { StoreModule, combineReducers, Store } from '@ngrx/store'; + +import * as fromI18n from '../reducer'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { Component } from '@angular/core'; +import { MessagesLoadSuccessAction } from '../action/message.action'; +import { TranslateDirective } from './translate.directive'; +import { MockI18nService, MockI18nModule } from '../../../testing/i18n.stub'; + +@Component({ + template: ` +
Word
+ ` +}) +class TestHostComponent { + private _foo: string; + + public get foo(): string { + return this._foo; + } + + public set foo(val: string) { + this._foo = val; + } +} + +describe('Directive: I18n translation', () => { + let fixture: ComponentFixture; + let instance: TestHostComponent; + let store: Store; + let service: I18nService; + + const msg = { + foo: 'foo', + bar: 'bar', + baz: 'baz' + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ + { provide: I18nService, useClass: MockI18nService } + ], + imports: [ + CommonModule, + StoreModule.forRoot({ + 'i18n': combineReducers(fromI18n.reducers), + }) + ], + declarations: [ + TranslateDirective, + TestHostComponent + ], + }); + store = TestBed.get(Store); + service = TestBed.get(I18nService); + + spyOn(store, 'dispatch').and.callThrough(); + + fixture = TestBed.createComponent(TestHostComponent); + instance = fixture.componentInstance; + }); + + it('should set the correct text', () => { + spyOn(service, 'translate').and.returnValue('foo'); + store.dispatch(new MessagesLoadSuccessAction(msg)); + + store.select(fromI18n.getMessages).subscribe(() => { + fixture.detectChanges(); + expect(fixture.nativeElement.textContent).toContain(msg.foo); + }); + }); +}); diff --git a/ui/src/app/i18n/i18n.module.ts b/ui/src/app/i18n/i18n.module.ts index 245504aba..b800ce48d 100644 --- a/ui/src/app/i18n/i18n.module.ts +++ b/ui/src/app/i18n/i18n.module.ts @@ -11,9 +11,11 @@ import { TranslatePipe } from './pipe/i18n.pipe'; import { CoreModule } from '../core/core.module'; import { TranslateDirective } from './directive/translate.directive'; import { TranslateComponent } from './component/translate.component'; +import { I18nTextComponent } from './component/i18n-text.component'; export const COMPONENTS = [ - TranslateComponent + TranslateComponent, + I18nTextComponent ]; export const DIRECTIVES = [ TranslateDirective diff --git a/ui/src/app/i18n/pipe/i18n.pipe.spec.ts b/ui/src/app/i18n/pipe/i18n.pipe.spec.ts index 1133c7ac8..b1fbc9cb9 100644 --- a/ui/src/app/i18n/pipe/i18n.pipe.spec.ts +++ b/ui/src/app/i18n/pipe/i18n.pipe.spec.ts @@ -11,7 +11,7 @@ import { MockI18nService, MockI18nModule } from '../../../testing/i18n.stub'; @Component({ template: ` - {{ foo | translate:{ foo: 'bar' } }} + {{ foo | translate }} ` }) class TestHostComponent { @@ -30,6 +30,7 @@ describe('Pipe: I18n translation', () => { let fixture: ComponentFixture; let instance: TestHostComponent; let store: Store; + let service: I18nService; beforeEach(() => { TestBed.configureTestingModule({ @@ -39,7 +40,7 @@ describe('Pipe: I18n translation', () => { imports: [ CommonModule, StoreModule.forRoot({ - 'message': combineReducers(fromI18n.reducers), + 'i18n': combineReducers(fromI18n.reducers), }) ], declarations: [ @@ -48,6 +49,7 @@ describe('Pipe: I18n translation', () => { ], }); store = TestBed.get(Store); + service = TestBed.get(I18nService); spyOn(store, 'dispatch').and.callThrough(); @@ -56,6 +58,7 @@ describe('Pipe: I18n translation', () => { }); it('should set the correct text', () => { + spyOn(service, 'translate').and.returnValue('hi there'); store.dispatch(new MessagesLoadSuccessAction({ foo: 'hi there' })); store.select(fromI18n.getMessages).subscribe(() => { diff --git a/ui/src/app/metadata/domain/component/forms/assertion-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/assertion-form.component.spec.ts index b91deb093..9cf43ca2e 100644 --- a/ui/src/app/metadata/domain/component/forms/assertion-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/assertion-form.component.spec.ts @@ -1,7 +1,6 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { StoreModule, Store, combineReducers } from '@ngrx/store'; import { ProviderValueEmitter, ProviderStatusEmitter } from '../../../domain/service/provider-change-emitter.service'; import { NgbPopoverModule, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap/popover/popover.module'; import { AssertionFormComponent } from './assertion-form.component'; diff --git a/ui/src/app/metadata/domain/component/forms/descriptor-info-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/descriptor-info-form.component.spec.ts index 0b3e542b3..7527f5e3c 100644 --- a/ui/src/app/metadata/domain/component/forms/descriptor-info-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/descriptor-info-form.component.spec.ts @@ -2,7 +2,6 @@ import { Component, ViewChild } from '@angular/core'; import { TestBed, ComponentFixture } from '@angular/core/testing'; import { ReactiveFormsModule, FormBuilder, Validators } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { StoreModule, Store, combineReducers } from '@ngrx/store'; import { ProviderValueEmitter, ProviderStatusEmitter } from '../../../domain/service/provider-change-emitter.service'; import { NgbPopoverModule, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap/popover/popover.module'; import { ListValuesService } from '../../../domain/service/list-values.service'; diff --git a/ui/src/app/metadata/domain/component/forms/finish-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/finish-form.component.spec.ts index 49d12efcd..0d3ea08a4 100644 --- a/ui/src/app/metadata/domain/component/forms/finish-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/finish-form.component.spec.ts @@ -13,7 +13,6 @@ import { ActivatedRouteStub } from '../../../../../testing/activated-route.stub' import * as stubs from '../../../../../testing/resolver.stub'; import { FileBackedHttpMetadataResolver } from '../../entity'; import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive'; -import { I18nTextComponent } from '../../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../../testing/i18n.stub'; @Component({ @@ -56,7 +55,6 @@ describe('Finished Form Component', () => { declarations: [ FinishFormComponent, RouterLinkStubDirective, - I18nTextComponent, InputDefaultsDirective, TestHostComponent ], diff --git a/ui/src/app/metadata/domain/component/forms/key-info-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/key-info-form.component.spec.ts index f829fcd20..fd6ccd5db 100644 --- a/ui/src/app/metadata/domain/component/forms/key-info-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/key-info-form.component.spec.ts @@ -10,7 +10,6 @@ import { KeyInfoFormComponent } from './key-info-form.component'; import * as stubs from '../../../../../testing/resolver.stub'; import { FileBackedHttpMetadataResolver } from '../../entity'; import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive'; -import { I18nTextComponent } from '../../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../../testing/i18n.stub'; @Component({ @@ -55,8 +54,7 @@ describe('Security (Key) Info Form Component', () => { declarations: [ KeyInfoFormComponent, TestHostComponent, - InputDefaultsDirective, - I18nTextComponent + InputDefaultsDirective ], }).compileComponents(); diff --git a/ui/src/app/metadata/domain/component/forms/logout-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/logout-form.component.spec.ts index 7c92a9e93..83f1fafe4 100644 --- a/ui/src/app/metadata/domain/component/forms/logout-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/logout-form.component.spec.ts @@ -11,7 +11,6 @@ import { LogoutFormComponent } from './logout-form.component'; import * as stubs from '../../../../../testing/resolver.stub'; import { FileBackedHttpMetadataResolver } from '../../entity'; import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive'; -import { I18nTextComponent } from '../../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../../testing/i18n.stub'; @Component({ @@ -53,8 +52,7 @@ describe('Logout Endpoints Form Component', () => { declarations: [ LogoutFormComponent, TestHostComponent, - InputDefaultsDirective, - I18nTextComponent + InputDefaultsDirective ], }); diff --git a/ui/src/app/metadata/domain/component/forms/metadata-ui-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/metadata-ui-form.component.spec.ts index be4c2ce63..b74dc94db 100644 --- a/ui/src/app/metadata/domain/component/forms/metadata-ui-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/metadata-ui-form.component.spec.ts @@ -10,7 +10,6 @@ import { MetadataUiFormComponent } from './metadata-ui-form.component'; import * as stubs from '../../../../../testing/resolver.stub'; import { FileBackedHttpMetadataResolver } from '../../entity'; import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive'; -import { I18nTextComponent } from '../../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../../testing/i18n.stub'; @Component({ @@ -51,8 +50,7 @@ describe('Metadata UI Form Component', () => { declarations: [ MetadataUiFormComponent, TestHostComponent, - InputDefaultsDirective, - I18nTextComponent + InputDefaultsDirective ], }); diff --git a/ui/src/app/metadata/domain/component/forms/organization-info-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/organization-info-form.component.spec.ts index f8875b4e8..57708fbad 100644 --- a/ui/src/app/metadata/domain/component/forms/organization-info-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/organization-info-form.component.spec.ts @@ -1,7 +1,6 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { StoreModule, Store, combineReducers } from '@ngrx/store'; import { ProviderValueEmitter, ProviderStatusEmitter } from '../../../domain/service/provider-change-emitter.service'; import { NgbPopoverModule, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap/popover/popover.module'; import { ListValuesService } from '../../../domain/service/list-values.service'; diff --git a/ui/src/app/metadata/domain/component/forms/relying-party-form.component.spec.ts b/ui/src/app/metadata/domain/component/forms/relying-party-form.component.spec.ts index d97ddb8ed..0849591c6 100644 --- a/ui/src/app/metadata/domain/component/forms/relying-party-form.component.spec.ts +++ b/ui/src/app/metadata/domain/component/forms/relying-party-form.component.spec.ts @@ -2,7 +2,6 @@ import { Component, ViewChild } from '@angular/core'; import { TestBed, ComponentFixture } from '@angular/core/testing'; import { ReactiveFormsModule, FormBuilder, Validators } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { StoreModule, Store, combineReducers } from '@ngrx/store'; import { ProviderValueEmitter, ProviderStatusEmitter } from '../../../domain/service/provider-change-emitter.service'; import { NgbPopoverModule, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap/popover/popover.module'; import { ListValuesService } from '../../../domain/service/list-values.service'; diff --git a/ui/src/app/metadata/provider/component/provider-editor-nav.component.spec.ts b/ui/src/app/metadata/provider/component/provider-editor-nav.component.spec.ts index d60ea9cb8..a43fe52d3 100644 --- a/ui/src/app/metadata/provider/component/provider-editor-nav.component.spec.ts +++ b/ui/src/app/metadata/provider/component/provider-editor-nav.component.spec.ts @@ -9,7 +9,6 @@ import * as fromRoot from '../reducer'; import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from 'ngx-schema-form'; import * as fromWizard from '../../../wizard/reducer'; import { ProviderEditorNavComponent, NAV_FORMATS } from './provider-editor-nav.component'; -import { I18nTextComponent } from '../../../shared/component/i18n-text.component'; import { ValidFormIconComponent } from '../../../shared/component/valid-form-icon.component'; import { WizardStep } from '../../../wizard/model'; import { MockI18nModule } from '../../../../testing/i18n.stub'; @@ -55,7 +54,6 @@ describe('Provider Editor Nav Component', () => { ], declarations: [ ProviderEditorNavComponent, - I18nTextComponent, ValidFormIconComponent, TestHostComponent ], diff --git a/ui/src/app/metadata/provider/container/provider-edit.component.spec.ts b/ui/src/app/metadata/provider/container/provider-edit.component.spec.ts index 29ce63571..951d48c77 100644 --- a/ui/src/app/metadata/provider/container/provider-edit.component.spec.ts +++ b/ui/src/app/metadata/provider/container/provider-edit.component.spec.ts @@ -16,6 +16,7 @@ import { NgbModalStub } from '../../../../testing/modal.stub'; import { MetadataProvider } from '../../domain/model'; import { of } from 'rxjs'; import { DifferentialService } from '../../../core/service/differential.service'; +import { MockI18nModule } from '../../../../testing/i18n.stub'; @Component({ template: ` @@ -61,7 +62,8 @@ describe('Provider Edit Component', () => { schemaCollection: [] } }) - }) + }), + MockI18nModule ], declarations: [ ProviderEditComponent, diff --git a/ui/src/app/metadata/provider/container/provider-filter-list.component.spec.ts b/ui/src/app/metadata/provider/container/provider-filter-list.component.spec.ts index 742a056e5..ee0450db2 100644 --- a/ui/src/app/metadata/provider/container/provider-filter-list.component.spec.ts +++ b/ui/src/app/metadata/provider/container/provider-filter-list.component.spec.ts @@ -7,10 +7,10 @@ import { ProviderFilterListComponent } from './provider-filter-list.component'; import * as fromRoot from '../reducer'; import * as fromWizard from '../../../wizard/reducer'; import { ProviderEditorNavComponent } from '../component/provider-editor-nav.component'; -import { I18nTextComponent } from '../../../shared/component/i18n-text.component'; import { ValidFormIconComponent } from '../../../shared/component/valid-form-icon.component'; import { DeleteFilterComponent } from '../component/delete-filter.component'; import { NgbModalStub } from '../../../../testing/modal.stub'; +import { MockI18nModule } from '../../../../testing/i18n.stub'; @Component({ template: ` @@ -37,12 +37,12 @@ describe('Provider Filter List Component', () => { StoreModule.forRoot({ provider: combineReducers(fromRoot.reducers), wizard: combineReducers(fromWizard.reducers) - }) + }), + MockI18nModule ], declarations: [ ProviderFilterListComponent, ProviderEditorNavComponent, - I18nTextComponent, ValidFormIconComponent, DeleteFilterComponent, TestHostComponent diff --git a/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts b/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts index 043663260..bbeb4f907 100644 --- a/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts +++ b/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts @@ -11,6 +11,7 @@ import { WizardModule } from '../../../wizard/wizard.module'; import { ProviderWizardSummaryComponent } from '../component/provider-wizard-summary.component'; import { SummaryPropertyComponent } from '../component/summary-property.component'; import * as fromWizard from '../../../wizard/reducer'; +import { MockI18nModule } from '../../../../testing/i18n.stub'; @Component({ template: ` @@ -38,7 +39,8 @@ describe('Provider Wizard Component', () => { StoreModule.forRoot({ provider: combineReducers(fromRoot.reducers), wizard: combineReducers(fromWizard.reducers) - }) + }), + MockI18nModule ], declarations: [ ProviderWizardComponent, diff --git a/ui/src/app/metadata/resolver/container/copy-resolver.component.spec.ts b/ui/src/app/metadata/resolver/container/copy-resolver.component.spec.ts index 6280d522d..c8473b155 100644 --- a/ui/src/app/metadata/resolver/container/copy-resolver.component.spec.ts +++ b/ui/src/app/metadata/resolver/container/copy-resolver.component.spec.ts @@ -7,7 +7,6 @@ import * as fromResolver from '../reducer'; import { CopyResolverComponent } from './copy-resolver.component'; import { SharedModule } from '../../../shared/shared.module'; import { NavigatorService } from '../../../core/service/navigator.service'; -import { I18nTextComponent } from '../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../testing/i18n.stub'; @Component({ diff --git a/ui/src/app/metadata/resolver/container/copy-resolver.component.ts b/ui/src/app/metadata/resolver/container/copy-resolver.component.ts index aec11cdb5..217fb4226 100644 --- a/ui/src/app/metadata/resolver/container/copy-resolver.component.ts +++ b/ui/src/app/metadata/resolver/container/copy-resolver.component.ts @@ -5,18 +5,15 @@ import { EventEmitter } from '@angular/core'; import { FormBuilder, FormGroup, FormControl, FormControlName, Validators, AbstractControl } from '@angular/forms'; -import { Observable, Subject, of } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { Store } from '@ngrx/store'; -import { startWith, take, last } from 'rxjs/operators'; +import { take } from 'rxjs/operators'; -import { AddDraftRequest } from '../action/draft.action'; -import { AddResolverRequest, UploadResolverRequest } from '../action/collection.action'; import * as fromResolver from '../reducer'; import { EntityValidators } from '../../domain/service/entity-validators.service'; import { SearchIds } from '../action/search.action'; import * as fromProvider from '../reducer'; -import { FileBackedHttpMetadataResolver } from '../../domain/entity'; import { CreateResolverCopyRequest, UpdateResolverCopySections } from '../action/copy.action'; diff --git a/ui/src/app/metadata/resolver/container/new-resolver.component.spec.ts b/ui/src/app/metadata/resolver/container/new-resolver.component.spec.ts index e36118bfa..68090592f 100644 --- a/ui/src/app/metadata/resolver/container/new-resolver.component.spec.ts +++ b/ui/src/app/metadata/resolver/container/new-resolver.component.spec.ts @@ -14,7 +14,6 @@ import { SharedModule } from '../../../shared/shared.module'; import { NavigatorService } from '../../../core/service/navigator.service'; import * as fromResolver from '../reducer'; import { ActivatedRouteStub } from '../../../../testing/activated-route.stub'; -import { I18nTextComponent } from '../../../shared/component/i18n-text.component'; import { MockI18nModule } from '../../../../testing/i18n.stub'; describe('New Resolver Page', () => { diff --git a/ui/src/app/shared/shared.module.ts b/ui/src/app/shared/shared.module.ts index b42e4d8c7..9896470a4 100644 --- a/ui/src/app/shared/shared.module.ts +++ b/ui/src/app/shared/shared.module.ts @@ -5,7 +5,6 @@ import { HighlightPipe } from './pipe/highlight.pipe'; import { AutoCompleteComponent } from './autocomplete/autocomplete.component'; import { ValidationClassDirective } from './validation/validation-class.directive'; import { InputDefaultsDirective } from './directive/input-defaults.directive'; -import { I18nTextComponent } from './component/i18n-text.component'; import { ValidFormIconComponent } from './component/valid-form-icon.component'; import { InfoLabelDirective } from './directive/info-label.directive'; import { PrettyXml } from './pipe/pretty-xml.pipe'; @@ -27,7 +26,6 @@ import { I18nModule } from '../i18n/i18n.module'; ToggleSwitchComponent, ValidationClassDirective, InputDefaultsDirective, - I18nTextComponent, ValidFormIconComponent, InfoLabelDirective, PrettyXml, @@ -42,7 +40,6 @@ import { I18nModule } from '../i18n/i18n.module'; ReactiveFormsModule, FormsModule, InputDefaultsDirective, - I18nTextComponent, ValidFormIconComponent, ValidationClassDirective, InfoLabelDirective, diff --git a/ui/src/testing/i18n.stub.ts b/ui/src/testing/i18n.stub.ts index 3e09c270e..3b38bef8c 100644 --- a/ui/src/testing/i18n.stub.ts +++ b/ui/src/testing/i18n.stub.ts @@ -9,8 +9,7 @@ import { CommonModule } from '@angular/common'; /*tslint:disable:component-selector */ @Pipe({ - name: 'translate', - pure: false + name: 'translate' }) export class MockTranslatePipe implements PipeTransform { @@ -29,6 +28,13 @@ export class MockTranslateDirective { @Input() translateParams: any | null; } +@Component({ + selector: 'i18n-text', + template: '' +}) +export class MockI18nTextComponent { + @Input() key: any | null; +} @Component({ selector: 'translate-i18n', @@ -80,11 +86,13 @@ export class MockI18nService { declarations: [ MockTranslatePipe, MockTranslateDirective, - MockTranslateComponent + MockTranslateComponent, + MockI18nTextComponent ], exports: [ MockTranslateComponent, MockTranslateDirective, + MockI18nTextComponent, MockTranslatePipe ], providers: [