diff --git a/ui/src/app/metadata/resolver/component/finish-form.component.spec.ts b/ui/src/app/metadata/resolver/component/finish-form.component.spec.ts
index 4bf37267c..31cd48302 100644
--- a/ui/src/app/metadata/resolver/component/finish-form.component.spec.ts
+++ b/ui/src/app/metadata/resolver/component/finish-form.component.spec.ts
@@ -83,7 +83,7 @@ describe('Finished Form Component', () => {
expect(form.form.reset).toHaveBeenCalled();
});
- xit('should reset the form with serviceEnabled = false if no resolver', () => {
+ it('should reset the form with serviceEnabled = false if no resolver', () => {
spyOn(form.form, 'reset').and.callThrough();
delete instance.resolver;
fixture.detectChanges();
diff --git a/ui/src/app/shared/component/info-icon.component.spec.ts b/ui/src/app/shared/component/info-icon.component.spec.ts
new file mode 100644
index 000000000..17fc4d216
--- /dev/null
+++ b/ui/src/app/shared/component/info-icon.component.spec.ts
@@ -0,0 +1,49 @@
+import { Component, ViewChild, Renderer, RootRenderer } from '@angular/core';
+import { TestBed, async, ComponentFixture } from '@angular/core/testing';
+import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
+import { MockI18nModule } from '../../../testing/i18n.stub';
+import { InfoIconComponent } from './info-icon.component';
+
+@Component({
+ template: `
+
+ `
+})
+class TestHostComponent {
+ @ViewChild(InfoIconComponent, { static: true })
+ public componentUnderTest: InfoIconComponent;
+
+ public description = 'Foo bar baz';
+}
+
+describe('Info Icon Component', () => {
+
+ let fixture: ComponentFixture;
+ let instance: TestHostComponent;
+ let app: InfoIconComponent;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ NgbPopoverModule,
+ MockI18nModule
+ ],
+ declarations: [
+ TestHostComponent,
+ InfoIconComponent
+ ],
+ providers: [
+ Renderer
+ ]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(TestHostComponent);
+ instance = fixture.componentInstance;
+ app = instance.componentUnderTest;
+ fixture.detectChanges();
+ }));
+
+ it('should display an information icon', async(() => {
+ expect(app).toBeTruthy();
+ }));
+});
diff --git a/ui/src/app/shared/component/info-icon.component.ts b/ui/src/app/shared/component/info-icon.component.ts
index 84ac09d0a..e11e928ad 100644
--- a/ui/src/app/shared/component/info-icon.component.ts
+++ b/ui/src/app/shared/component/info-icon.component.ts
@@ -21,7 +21,6 @@ export class InfoIconComponent {
private renderer: Renderer
) { }
focus(element): void {
- console.log(element.elementRef.nativeElement);
this.renderer.invokeElementMethod(element.elementRef.nativeElement, 'focus');
}
}
diff --git a/ui/src/app/shared/component/valid-form-icon.component.spec.ts b/ui/src/app/shared/component/valid-form-icon.component.spec.ts
new file mode 100644
index 000000000..c15c39e4d
--- /dev/null
+++ b/ui/src/app/shared/component/valid-form-icon.component.spec.ts
@@ -0,0 +1,49 @@
+import { Component, ViewChild, Renderer, RootRenderer } from '@angular/core';
+import { TestBed, async, ComponentFixture } from '@angular/core/testing';
+import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
+import { MockI18nModule } from '../../../testing/i18n.stub';
+import { ValidFormIconComponent } from './valid-form-icon.component';
+
+@Component({
+ template: `
+
+ `
+})
+class TestHostComponent {
+ @ViewChild(ValidFormIconComponent, { static: true })
+ public componentUnderTest: ValidFormIconComponent;
+
+ public status = 'INVALID';
+}
+
+describe('Info Icon Component', () => {
+
+ let fixture: ComponentFixture;
+ let instance: TestHostComponent;
+ let app: ValidFormIconComponent;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ NgbPopoverModule,
+ MockI18nModule
+ ],
+ declarations: [
+ TestHostComponent,
+ ValidFormIconComponent
+ ],
+ providers: [
+ Renderer
+ ]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(TestHostComponent);
+ instance = fixture.componentInstance;
+ app = instance.componentUnderTest;
+ fixture.detectChanges();
+ }));
+
+ it('should display an information icon', async(() => {
+ expect(app).toBeTruthy();
+ }));
+});
diff --git a/ui/src/app/shared/pipe/replace.pipe.ts b/ui/src/app/shared/pipe/replace.pipe.ts
deleted file mode 100644
index 16fd97ce3..000000000
--- a/ui/src/app/shared/pipe/replace.pipe.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { PipeTransform, Pipe } from '@angular/core';
-import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
-
-@Pipe({ name: 'replace' })
-export class ReplacePipe implements PipeTransform {
- constructor(public sanitizer: DomSanitizer) { }
- transform(value: string, query: { [propName: string]: string }): SafeHtml {
- return '';
- }
-}
diff --git a/ui/src/app/shared/shared.module.ts b/ui/src/app/shared/shared.module.ts
index e033083a0..75dd7911c 100644
--- a/ui/src/app/shared/shared.module.ts
+++ b/ui/src/app/shared/shared.module.ts
@@ -9,7 +9,6 @@ import { ValidFormIconComponent } from './component/valid-form-icon.component';
import { PrettyXml } from './pipe/pretty-xml.pipe';
import { ToggleSwitchComponent } from './switch/switch.component';
import { ContenteditableDirective } from './contenteditable/contenteditable.directive';
-import { ReplacePipe } from './pipe/replace.pipe';
import { I18nModule } from '../i18n/i18n.module';
import { CustomDatePipe } from './pipe/date.pipe';
import { InfoIconComponent } from './component/info-icon.component';
@@ -31,7 +30,6 @@ import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
InputDefaultsDirective,
ValidFormIconComponent,
PrettyXml,
- ReplacePipe,
CustomDatePipe,
ContenteditableDirective,
InfoIconComponent
@@ -47,7 +45,6 @@ import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
ValidFormIconComponent,
ValidationClassDirective,
ContenteditableDirective,
- ReplacePipe,
CustomDatePipe,
InfoIconComponent
]
diff --git a/ui/src/app/wizard/component/wizard.component.spec.ts b/ui/src/app/wizard/component/wizard.component.spec.ts
index 250db89da..9105e2d82 100644
--- a/ui/src/app/wizard/component/wizard.component.spec.ts
+++ b/ui/src/app/wizard/component/wizard.component.spec.ts
@@ -5,7 +5,8 @@ import { StoreModule, Store, combineReducers } from '@ngrx/store';
import * as fromWizard from '../reducer';
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
-import { WizardComponent, ICONS } from './wizard.component';
+import { WizardComponent } from './wizard.component';
+import { WizardService } from '../service/wizard.service';
import { MockI18nModule } from '../../../testing/i18n.stub';
@Component({
@@ -39,6 +40,9 @@ describe('Wizard Component', () => {
WizardComponent,
TestHostComponent
],
+ providers: [
+ WizardService
+ ]
}).compileComponents();
store = TestBed.get(Store);
@@ -53,14 +57,4 @@ describe('Wizard Component', () => {
it('should compile without error', () => {
expect(app).toBeTruthy();
});
-
- describe('getIcon method', () => {
- it('should return the check string for the last index', () => {
- expect(app.getIcon({ index: 'foo' }, { index: 'foo' })).toEqual(ICONS.CHECK);
- });
- it('should return the index icon for other indexes', () => {
- expect(app.getIcon({ index: 'foo' }, { index: 'bar' })).toEqual(ICONS.INDEX);
- expect(app.getIcon({ index: 'foo' }, null)).toEqual(ICONS.INDEX);
- });
- });
});
diff --git a/ui/src/app/wizard/component/wizard.component.ts b/ui/src/app/wizard/component/wizard.component.ts
index 7b4aa8ff4..1b7103c93 100644
--- a/ui/src/app/wizard/component/wizard.component.ts
+++ b/ui/src/app/wizard/component/wizard.component.ts
@@ -4,12 +4,7 @@ import { Wizard, WizardStep } from '../model';
import * as fromWizard from '../reducer';
import { Observable } from 'rxjs';
import { withLatestFrom, map } from 'rxjs/operators';
-
-export enum ICONS {
- CHECK = 'CHECK',
- INDEX = 'INDEX'
-}
-
+import { WizardService } from '../service/wizard.service';
/*tslint:disable:component-selector */
@Component({
@@ -38,10 +33,11 @@ export class WizardComponent {
currentIcon$: Observable;
- icons = ICONS;
+ icons = this.service.icons;
constructor(
- private store: Store
+ private store: Store,
+ private service: WizardService
) {
this.index$ = this.store.select(fromWizard.getWizardIndex);
this.definition$ = this.store.select(fromWizard.getWizardDefinition);
@@ -53,11 +49,7 @@ export class WizardComponent {
this.currentIcon$ = this.current$.pipe(
withLatestFrom(this.last$),
- map(([current, last]) => this.getIcon(current, last))
+ map(([current, last]) => this.service.getIcon(current, last))
);
}
-
- getIcon(current, last): string {
- return (last && current.index === last.index) ? ICONS.CHECK : ICONS.INDEX;
- }
}
diff --git a/ui/src/app/wizard/service/wizard.service.spec.ts b/ui/src/app/wizard/service/wizard.service.spec.ts
new file mode 100644
index 000000000..f7aa204cd
--- /dev/null
+++ b/ui/src/app/wizard/service/wizard.service.spec.ts
@@ -0,0 +1,26 @@
+import { WizardService, ICONS } from './wizard.service';
+import { TestBed } from '@angular/core/testing';
+
+describe('Wizard Service', () => {
+ let service: WizardService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [
+ WizardService
+ ]
+ });
+
+ service = TestBed.get(WizardService);
+ });
+
+ describe('getIcon method', () => {
+ it('should return the check string for the last index', () => {
+ expect(service.getIcon({ index: 'foo' }, { index: 'foo' })).toEqual(ICONS.CHECK);
+ });
+ it('should return the index icon for other indexes', () => {
+ expect(service.getIcon({ index: 'foo' }, { index: 'bar' })).toEqual(ICONS.INDEX);
+ expect(service.getIcon({ index: 'foo' }, null)).toEqual(ICONS.INDEX);
+ });
+ });
+});
diff --git a/ui/src/app/wizard/service/wizard.service.ts b/ui/src/app/wizard/service/wizard.service.ts
new file mode 100644
index 000000000..83eebe089
--- /dev/null
+++ b/ui/src/app/wizard/service/wizard.service.ts
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+
+
+export enum ICONS {
+ CHECK = 'CHECK',
+ INDEX = 'INDEX'
+}
+
+@Injectable()
+export class WizardService {
+
+ public icons = ICONS;
+
+ constructor() { }
+
+ getIcon(current, last): string {
+ return (last && current.index === last.index) ? ICONS.CHECK : ICONS.INDEX;
+ }
+}
diff --git a/ui/src/app/wizard/wizard.module.spec.ts b/ui/src/app/wizard/wizard.module.spec.ts
new file mode 100644
index 000000000..547090d8f
--- /dev/null
+++ b/ui/src/app/wizard/wizard.module.spec.ts
@@ -0,0 +1,21 @@
+import { WizardModule } from './wizard.module';
+import { TestBed } from '@angular/core/testing';
+import { WizardService } from './service/wizard.service';
+import { StoreModule } from '@ngrx/store';
+import { EffectsModule } from '@ngrx/effects';
+
+describe('Wizard Module', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ StoreModule.forRoot({}),
+ EffectsModule.forRoot([]),
+ WizardModule.forRoot()
+ ]
+ });
+ });
+
+ it('should compile', () => {
+ expect(TestBed.get(WizardService)).toBeDefined();
+ });
+});
diff --git a/ui/src/app/wizard/wizard.module.ts b/ui/src/app/wizard/wizard.module.ts
index a02decbb8..34a196d14 100644
--- a/ui/src/app/wizard/wizard.module.ts
+++ b/ui/src/app/wizard/wizard.module.ts
@@ -6,6 +6,7 @@ import { EffectsModule } from '@ngrx/effects';
import { WizardComponent } from './component/wizard.component';
import { reducers } from './reducer';
import { I18nModule } from '../i18n/i18n.module';
+import { WizardService } from './service/wizard.service';
@NgModule({
declarations: [
@@ -24,7 +25,7 @@ export class WizardModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: RootWizardModule,
- providers: []
+ providers: [WizardService]
};
}
}
diff --git a/ui/src/testing/descriptor.service.stub.ts b/ui/src/testing/descriptor.service.stub.ts
new file mode 100644
index 000000000..e69de29bb