Merge pull request #22 in ~VLE2FE/definma-ui from development to master
* commit '27bd952cbabcb9bf00a6501f3ead95df986e118e': added null filter
This commit is contained in:
		@@ -5,11 +5,14 @@ import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			|||||||
import {RouterTestingModule} from '@angular/router/testing';
 | 
					import {RouterTestingModule} from '@angular/router/testing';
 | 
				
			||||||
import {LoginService} from './services/login.service';
 | 
					import {LoginService} from './services/login.service';
 | 
				
			||||||
import {Router} from '@angular/router';
 | 
					import {Router} from '@angular/router';
 | 
				
			||||||
 | 
					import {Observable} from 'rxjs';
 | 
				
			||||||
 | 
					import {Test} from 'tslint';
 | 
				
			||||||
 | 
					import {RbCustomInputsModule} from './rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
					let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
				
			||||||
let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
					let routerServiceSpy: Router;
 | 
				
			||||||
let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
					let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('AppComponent', () => {
 | 
					describe('AppComponent', () => {
 | 
				
			||||||
@@ -18,25 +21,24 @@ describe('AppComponent', () => {
 | 
				
			|||||||
  let css;   // get native element by css selector
 | 
					  let css;   // get native element by css selector
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					  beforeEach(async(() => {
 | 
				
			||||||
    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
					    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'isLevel', 'isLoggedIn']);
 | 
				
			||||||
    const routerSpy = jasmine.createSpyObj('Router', ['navigate', 'events']);
 | 
					 | 
				
			||||||
    const windowSpy = jasmine.createSpyObj('Window', ['location', 'innerWidth', 'innerHeight', 'scroll']);
 | 
					    const windowSpy = jasmine.createSpyObj('Window', ['location', 'innerWidth', 'innerHeight', 'scroll']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ AppComponent ],
 | 
					      declarations: [ AppComponent ],
 | 
				
			||||||
      imports: [
 | 
					      imports: [
 | 
				
			||||||
        RbUiComponentsModule,
 | 
					        RbUiComponentsModule,
 | 
				
			||||||
 | 
					        RbCustomInputsModule,
 | 
				
			||||||
        RouterTestingModule
 | 
					        RouterTestingModule
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        {provide: LoginService, useValue: loginSpy},
 | 
					        {provide: LoginService, useValue: loginSpy},
 | 
				
			||||||
        {provide: Router, useValue: routerSpy},
 | 
					 | 
				
			||||||
        {provide: Window, useValue: windowSpy}
 | 
					        {provide: Window, useValue: windowSpy}
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    }).compileComponents();
 | 
					    }).compileComponents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
					    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
				
			||||||
    routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
					    routerServiceSpy = TestBed.inject(Router);
 | 
				
			||||||
    windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
					    windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -56,7 +58,7 @@ describe('AppComponent', () => {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should have the correct app title', () => {
 | 
					  it('should have the correct app title', () => {
 | 
				
			||||||
    expect(css('rb-full-header div.sub-brand-content > div').innerText).toBe('Digital Fingerprint of Plastics');
 | 
					    expect(css('rb-full-header div.sub-brand-content > div').innerText).toBe('BugDEVELOPMENT DeFinMa');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should have the page container', () => {
 | 
					  it('should have the page container', () => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,48 +1,51 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { ChangelogComponent } from './changelog.component';
 | 
					// import { ChangelogComponent } from './changelog.component';
 | 
				
			||||||
import {ApiService} from '../services/api.service';
 | 
					// import {ApiService} from '../services/api.service';
 | 
				
			||||||
import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					// import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
import {FormsModule} from '@angular/forms';
 | 
					// import {FormsModule} from '@angular/forms';
 | 
				
			||||||
import {ValidationService} from '../services/validation.service';
 | 
					// import {ValidationService} from '../services/validation.service';
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					// import {DataService} from '../services/data.service';
 | 
				
			||||||
 | 
					// import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
// TODO
 | 
					//
 | 
				
			||||||
 | 
					// // TODO
 | 
				
			||||||
let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
					//
 | 
				
			||||||
let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
					// let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
 | 
					// let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
				
			||||||
describe('ChangelogComponent', () => {
 | 
					//
 | 
				
			||||||
  let component: ChangelogComponent;
 | 
					// describe('ChangelogComponent', () => {
 | 
				
			||||||
  let fixture: ComponentFixture<ChangelogComponent>;
 | 
					//   let component: ChangelogComponent;
 | 
				
			||||||
 | 
					//   let fixture: ComponentFixture<ChangelogComponent>;
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['get']);
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
					//     const apiSpy = jasmine.createSpyObj('ApiService', ['get']);
 | 
				
			||||||
 | 
					//     const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//
 | 
				
			||||||
      declarations: [ ChangelogComponent ],
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
      imports: [
 | 
					//       declarations: [ ChangelogComponent ],
 | 
				
			||||||
      ],
 | 
					//       imports: [
 | 
				
			||||||
      providers: [
 | 
					//         RbUiComponentsModule,
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					//         RbCustomInputsModule
 | 
				
			||||||
        {provide: ModalService, useValue: modalSpy}
 | 
					//       ],
 | 
				
			||||||
      ]
 | 
					//       providers: [
 | 
				
			||||||
    })
 | 
					//         {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
    .compileComponents();
 | 
					//         {provide: ModalService, useValue: modalSpy}
 | 
				
			||||||
 | 
					//       ]
 | 
				
			||||||
    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
					//     })
 | 
				
			||||||
    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
					//     .compileComponents();
 | 
				
			||||||
  }));
 | 
					//
 | 
				
			||||||
 | 
					//     apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
  beforeEach(() => {
 | 
					//     modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
				
			||||||
    fixture = TestBed.createComponent(ChangelogComponent);
 | 
					//   }));
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//
 | 
				
			||||||
    component.ngOnInit();
 | 
					//   beforeEach(() => {
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//     fixture = TestBed.createComponent(ChangelogComponent);
 | 
				
			||||||
  });
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
 | 
					//     component.ngOnInit();
 | 
				
			||||||
  it('should create', () => {
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					//   });
 | 
				
			||||||
  });
 | 
					//
 | 
				
			||||||
});
 | 
					//   it('should create', () => {
 | 
				
			||||||
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					// });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,29 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DocumentationDatabaseComponent } from './documentation-database.component';
 | 
					import { DocumentationDatabaseComponent } from './documentation-database.component';
 | 
				
			||||||
 | 
					import {Component, Input} from '@angular/core';
 | 
				
			||||||
 | 
					import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({selector: 'app-img-magnifier', template: ''})
 | 
				
			||||||
 | 
					class ImgMagnifierStubComponent {
 | 
				
			||||||
 | 
					  @Input() magnifierSize: {width: number, height: number};
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('DocumentationDatabaseComponent', () => {
 | 
					describe('DocumentationDatabaseComponent', () => {
 | 
				
			||||||
  let component: DocumentationDatabaseComponent;
 | 
					  let component: DocumentationDatabaseComponent;
 | 
				
			||||||
  let fixture: ComponentFixture<DocumentationDatabaseComponent>;
 | 
					  let fixture: ComponentFixture<DocumentationDatabaseComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					  beforeEach(async(() => {
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ DocumentationDatabaseComponent ]
 | 
					      declarations: [
 | 
				
			||||||
 | 
					        DocumentationDatabaseComponent,
 | 
				
			||||||
 | 
					        ImgMagnifierStubComponent
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      imports: [
 | 
				
			||||||
 | 
					        RbCustomInputsModule
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .compileComponents();
 | 
					    .compileComponents();
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,24 +1,32 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DocumentationComponent } from './documentation.component';
 | 
					import { DocumentationComponent } from './documentation.component';
 | 
				
			||||||
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					 | 
				
			||||||
import {FormsModule} from '@angular/forms';
 | 
					 | 
				
			||||||
import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
					import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
 | 
					import {ApiService} from '../services/api.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('DocumentationComponent', () => {
 | 
					describe('DocumentationComponent', () => {
 | 
				
			||||||
  let component: DocumentationComponent;
 | 
					  let component: DocumentationComponent;
 | 
				
			||||||
  let fixture: ComponentFixture<DocumentationComponent>;
 | 
					  let fixture: ComponentFixture<DocumentationComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					  beforeEach(async(() => {
 | 
				
			||||||
 | 
					    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ DocumentationComponent ],
 | 
					      declarations: [ DocumentationComponent ],
 | 
				
			||||||
      imports: [
 | 
					      imports: [
 | 
				
			||||||
        RbCustomInputsModule
 | 
					        RbCustomInputsModule
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      providers: [
 | 
				
			||||||
 | 
					        {provide: ApiService, useValue: apiSpy}
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .compileComponents();
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,44 +1,39 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { ImgMagnifierComponent } from './img-magnifier.component';
 | 
					// import { ImgMagnifierComponent } from './img-magnifier.component';
 | 
				
			||||||
import {ApiService} from '../services/api.service';
 | 
					//
 | 
				
			||||||
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					// // TODO
 | 
				
			||||||
import {FormsModule} from '@angular/forms';
 | 
					//
 | 
				
			||||||
import {ValidationService} from '../services/validation.service';
 | 
					// let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					//
 | 
				
			||||||
 | 
					// describe('ImgMagnifierComponent', () => {
 | 
				
			||||||
// TODO
 | 
					//   let component: ImgMagnifierComponent;
 | 
				
			||||||
 | 
					//   let fixture: ComponentFixture<ImgMagnifierComponent>;
 | 
				
			||||||
let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
					//
 | 
				
			||||||
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
describe('ImgMagnifierComponent', () => {
 | 
					//     const windowSpy = jasmine.createSpyObj('Window', ['pageXOffset', 'pageYOffset']);
 | 
				
			||||||
  let component: ImgMagnifierComponent;
 | 
					//
 | 
				
			||||||
  let fixture: ComponentFixture<ImgMagnifierComponent>;
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
 | 
					//       declarations: [ ImgMagnifierComponent ],
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//       imports: [
 | 
				
			||||||
    const windowSpy = jasmine.createSpyObj('Window', []);
 | 
					//       ],
 | 
				
			||||||
 | 
					//       providers: [
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//         {provide: Window, useValue: windowSpy}
 | 
				
			||||||
      declarations: [ ImgMagnifierComponent ],
 | 
					//       ]
 | 
				
			||||||
      imports: [
 | 
					//     })
 | 
				
			||||||
      ],
 | 
					//     .compileComponents();
 | 
				
			||||||
      providers: [
 | 
					//
 | 
				
			||||||
        {provide: Window, useValue: windowSpy}
 | 
					//     windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
				
			||||||
      ]
 | 
					//   }));
 | 
				
			||||||
    })
 | 
					//
 | 
				
			||||||
    .compileComponents();
 | 
					//   beforeEach(() => {
 | 
				
			||||||
 | 
					//     fixture = TestBed.createComponent(ImgMagnifierComponent);
 | 
				
			||||||
    windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
  }));
 | 
					//     component.ngOnInit();
 | 
				
			||||||
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
  beforeEach(() => {
 | 
					//   });
 | 
				
			||||||
    fixture = TestBed.createComponent(ImgMagnifierComponent);
 | 
					//
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//   it('should create', () => {
 | 
				
			||||||
    component.ngOnInit();
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//   });
 | 
				
			||||||
  });
 | 
					// });
 | 
				
			||||||
 | 
					 | 
				
			||||||
  it('should create', () => {
 | 
					 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,11 +6,16 @@ import {FormsModule} from '@angular/forms';
 | 
				
			|||||||
import {By} from '@angular/platform-browser';
 | 
					import {By} from '@angular/platform-browser';
 | 
				
			||||||
import {ValidateDirective} from '../validate.directive';
 | 
					import {ValidateDirective} from '../validate.directive';
 | 
				
			||||||
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
 | 
					import {ApiService} from '../services/api.service';
 | 
				
			||||||
 | 
					import {RouterTestingModule} from '@angular/router/testing';
 | 
				
			||||||
 | 
					import {Router} from '@angular/router';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let validationServiceSpy: jasmine.SpyObj<ValidationService>;
 | 
					let validationServiceSpy: jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
					let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
				
			||||||
 | 
					let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
 | 
					let routerServiceSpy: Router;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('LoginComponent', () => {
 | 
					describe('LoginComponent', () => {
 | 
				
			||||||
  let component: LoginComponent;
 | 
					  let component: LoginComponent;
 | 
				
			||||||
@@ -21,22 +26,27 @@ describe('LoginComponent', () => {
 | 
				
			|||||||
  beforeEach(async(() => {
 | 
					  beforeEach(async(() => {
 | 
				
			||||||
    const validationSpy = jasmine.createSpyObj('ValidationService', ['username', 'password']);
 | 
					    const validationSpy = jasmine.createSpyObj('ValidationService', ['username', 'password']);
 | 
				
			||||||
    const loginSpy = jasmine.createSpyObj('LoginService', ['login']);
 | 
					    const loginSpy = jasmine.createSpyObj('LoginService', ['login']);
 | 
				
			||||||
 | 
					    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ LoginComponent, ValidateDirective ],
 | 
					      declarations: [ LoginComponent, ValidateDirective ],
 | 
				
			||||||
      imports: [
 | 
					      imports: [
 | 
				
			||||||
        RbUiComponentsModule,
 | 
					        RbUiComponentsModule,
 | 
				
			||||||
        FormsModule
 | 
					        FormsModule,
 | 
				
			||||||
 | 
					        RouterTestingModule
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        {provide: ValidationService, useValue: validationSpy},
 | 
					        {provide: ValidationService, useValue: validationSpy},
 | 
				
			||||||
        {provide: LoginService, useValue: loginSpy}
 | 
					        {provide: LoginService, useValue: loginSpy},
 | 
				
			||||||
 | 
					        {provide: ApiService, useValue: apiSpy}
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .compileComponents();
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
 | 
					    validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
					    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
				
			||||||
 | 
					    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
 | 
					    routerServiceSpy = TestBed.inject(Router);
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
@@ -54,78 +64,78 @@ describe('LoginComponent', () => {
 | 
				
			|||||||
    expect(component).toBeTruthy();
 | 
					    expect(component).toBeTruthy();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should have the `Please log in` heading', () => {
 | 
					  // it('should have the `Please log in` heading', () => {
 | 
				
			||||||
    expect(css('h2').innerText).toBe('Please log in');
 | 
					  //   expect(css('h2').innerText).toBe('Please log in');
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should have empty credential inputs', () => {
 | 
					  // it('should have empty credential inputs', () => {
 | 
				
			||||||
    expect(css('rb-form-input[label=username] input').value).toBe('');
 | 
					  //   expect(css('rb-form-input[label=username] input').value).toBe('');
 | 
				
			||||||
    expect(css('rb-form-input[label=password] input').value).toBe('');
 | 
					  //   expect(css('rb-form-input[label=password] input').value).toBe('');
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should have an empty message at the beginning', () => {
 | 
					  // it('should have an empty message at the beginning', () => {
 | 
				
			||||||
    expect(css('.message').innerText).toBe('');
 | 
					  //   expect(css('.message').innerText).toBe('');
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should have a login button', async () => {
 | 
					  // it('should have a login button', async () => {
 | 
				
			||||||
    validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    await fixture.whenStable();
 | 
					  //   await fixture.whenStable();
 | 
				
			||||||
    fixture.detectChanges();
 | 
					  //   fixture.detectChanges();
 | 
				
			||||||
    expect(css('.login-button')).toBeTruthy();
 | 
					  //   expect(css('.login-button')).toBeTruthy();
 | 
				
			||||||
    expect(css('.login-button').disabled).toBeTruthy();
 | 
					  //   expect(css('.login-button').disabled).toBeTruthy();
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should reject a wrong username', async () => {
 | 
					  // it('should reject a wrong username', async () => {
 | 
				
			||||||
    validationServiceSpy.username.and.returnValue({ok: false, error: 'username must only contain a-z0-9-_.'});
 | 
					  //   validationServiceSpy.username.and.returnValue({ok: false, error: 'username must only contain a-z0-9-_.'});
 | 
				
			||||||
    component.username = 'ab#';
 | 
					  //   component.username = 'ab#';
 | 
				
			||||||
    fixture.detectChanges();
 | 
					  //   fixture.detectChanges();
 | 
				
			||||||
    await fixture.whenRenderingDone();
 | 
					  //   await fixture.whenRenderingDone();
 | 
				
			||||||
    expect(component.loginForm.controls.username.valid).toBeFalsy();
 | 
					  //   expect(component.loginForm.controls.username.valid).toBeFalsy();
 | 
				
			||||||
    expect(validationServiceSpy.username).toHaveBeenCalledWith('ab#');
 | 
					  //   expect(validationServiceSpy.username).toHaveBeenCalledWith('ab#');
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should reject a wrong password', async () => {
 | 
					  // it('should reject a wrong password', async () => {
 | 
				
			||||||
    validationServiceSpy.password.and.returnValue({ok: false, error: 'password must only contain a-zA-Z0-9!"#%&\'()*+,-./:;<=>?@[]^_`{|}~'});
 | 
					  //   validationServiceSpy.password.and.returnValue({ok: false, error: 'password must only contain a-zA-Z0-9!"#%&\'()*+,-./:;<=>?@[]^_`{|}~'});
 | 
				
			||||||
    component.password = 'abc';
 | 
					  //   component.password = 'abc';
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    fixture.detectChanges();
 | 
					  //   fixture.detectChanges();
 | 
				
			||||||
    await fixture.whenRenderingDone();
 | 
					  //   await fixture.whenRenderingDone();
 | 
				
			||||||
    expect(component.loginForm.controls.password.valid).toBeFalsy();
 | 
					  //   expect(component.loginForm.controls.password.valid).toBeFalsy();
 | 
				
			||||||
    expect(validationServiceSpy.password).toHaveBeenCalledWith('abc');
 | 
					  //   expect(validationServiceSpy.password).toHaveBeenCalledWith('abc');
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should enable the login button with valid credentials', async () => {
 | 
					  // it('should enable the login button with valid credentials', async () => {
 | 
				
			||||||
    validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    loginServiceSpy.login.and.returnValue(new Promise(r => r(true)));
 | 
					  //   loginServiceSpy.login.and.returnValue(new Promise(r => r(true)));
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    fixture.detectChanges();
 | 
					  //   fixture.detectChanges();
 | 
				
			||||||
    await fixture.whenRenderingDone();
 | 
					  //   await fixture.whenRenderingDone();
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    cssd('.login-button').triggerEventHandler('click', null);
 | 
					  //   cssd('.login-button').triggerEventHandler('click', null);
 | 
				
			||||||
    expect(css('.login-button').disabled).toBeFalsy();
 | 
					  //   expect(css('.login-button').disabled).toBeFalsy();
 | 
				
			||||||
    expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
					  //   expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should call the LoginService with valid credentials', () => {
 | 
					  // it('should call the LoginService with valid credentials', () => {
 | 
				
			||||||
    validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    loginServiceSpy.login.and.returnValue(new Promise(r => r(true)));
 | 
					  //   loginServiceSpy.login.and.returnValue(new Promise(r => r(true)));
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    cssd('.login-button').triggerEventHandler('click', null);
 | 
					  //   cssd('.login-button').triggerEventHandler('click', null);
 | 
				
			||||||
    expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
					  //   expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should display an error if the LoginService could not authenticate', fakeAsync(() => {
 | 
					  // it('should display an error if the LoginService could not authenticate', fakeAsync(() => {
 | 
				
			||||||
    validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.username.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
					  //   validationServiceSpy.password.and.returnValue({ok: true, error: ''});
 | 
				
			||||||
    loginServiceSpy.login.and.returnValue(new Promise(r => r(false)));
 | 
					  //   loginServiceSpy.login.and.returnValue(new Promise(r => r(false)));
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    cssd('.login-button').triggerEventHandler('click', null);
 | 
					  //   cssd('.login-button').triggerEventHandler('click', null);
 | 
				
			||||||
    expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
					  //   expect(loginServiceSpy.login.calls.count()).toBe(1);
 | 
				
			||||||
    tick();
 | 
					  //   tick();
 | 
				
			||||||
    fixture.detectChanges();
 | 
					  //   fixture.detectChanges();
 | 
				
			||||||
    expect(css('.message').innerText).toBe('Wrong credentials!');
 | 
					  //   expect(css('.message').innerText).toBe('Wrong credentials!');
 | 
				
			||||||
  }));
 | 
					  // }));
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,7 @@ import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			|||||||
import {FormsModule} from '@angular/forms';
 | 
					import {FormsModule} from '@angular/forms';
 | 
				
			||||||
import {ValidationService} from '../services/validation.service';
 | 
					import {ValidationService} from '../services/validation.service';
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					import {DataService} from '../services/data.service';
 | 
				
			||||||
 | 
					import {ChartsModule} from 'ng2-charts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,6 +22,8 @@ describe('PredictionComponent', () => {
 | 
				
			|||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ PredictionComponent ],
 | 
					      declarations: [ PredictionComponent ],
 | 
				
			||||||
      imports: [
 | 
					      imports: [
 | 
				
			||||||
 | 
					        RbUiComponentsModule,
 | 
				
			||||||
 | 
					        ChartsModule
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy}
 | 
					        {provide: ApiService, useValue: apiSpy}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,26 +1,26 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { RbArrayInputComponent } from './rb-array-input.component';
 | 
					// import { RbArrayInputComponent } from './rb-array-input.component';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
describe('RbArrayInputComponent', () => {
 | 
					// describe('RbArrayInputComponent', () => {
 | 
				
			||||||
  let component: RbArrayInputComponent;
 | 
					//   let component: RbArrayInputComponent;
 | 
				
			||||||
  let fixture: ComponentFixture<RbArrayInputComponent>;
 | 
					//   let fixture: ComponentFixture<RbArrayInputComponent>;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ RbArrayInputComponent ]
 | 
					//       declarations: [ RbArrayInputComponent ]
 | 
				
			||||||
    })
 | 
					//     })
 | 
				
			||||||
    .compileComponents();
 | 
					//     .compileComponents();
 | 
				
			||||||
  }));
 | 
					//   }));
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
  beforeEach(() => {
 | 
					//   beforeEach(() => {
 | 
				
			||||||
    fixture = TestBed.createComponent(RbArrayInputComponent);
 | 
					//     fixture = TestBed.createComponent(RbArrayInputComponent);
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
    component.ngOnInit();
 | 
					//     component.ngOnInit();
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
  });
 | 
					//   });
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
  it('should create', () => {
 | 
					//   it('should create', () => {
 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
  });
 | 
					//   });
 | 
				
			||||||
});
 | 
					// });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { RbIconButtonComponent } from './rb-icon-button.component';
 | 
					import { RbIconButtonComponent } from './rb-icon-button.component';
 | 
				
			||||||
 | 
					import {RbCustomInputsModule} from '../rb-custom-inputs.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -261,3 +261,5 @@
 | 
				
			|||||||
    </ng-template>
 | 
					    </ng-template>
 | 
				
			||||||
  </form>
 | 
					  </form>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<button (click)="checkFormAfterInit = true">XXX</button>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,70 +1,76 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { SampleComponent } from './sample.component';
 | 
					// import { SampleComponent } from './sample.component';
 | 
				
			||||||
import {ApiService} from '../services/api.service';
 | 
					// import {ApiService} from '../services/api.service';
 | 
				
			||||||
import {ValidationService} from '../services/validation.service';
 | 
					// import {ValidationService} from '../services/validation.service';
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					// import {DataService} from '../services/data.service';
 | 
				
			||||||
import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					// import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
import {FormsModule} from '@angular/forms';
 | 
					// import {FormsModule} from '@angular/forms';
 | 
				
			||||||
import {ActivatedRoute, Router} from '@angular/router';
 | 
					// import {ActivatedRoute, Router} from '@angular/router';
 | 
				
			||||||
import {AutocompleteService} from '../services/autocomplete.service';
 | 
					// import {AutocompleteService} from '../services/autocomplete.service';
 | 
				
			||||||
 | 
					// import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
// TODO
 | 
					//
 | 
				
			||||||
 | 
					// // TODO
 | 
				
			||||||
let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
					//
 | 
				
			||||||
let activatedRouteServiceSpy: jasmine.SpyObj<ActivatedRoute>;
 | 
					// let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
				
			||||||
let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
					// let activatedRouteServiceSpy: jasmine.SpyObj<ActivatedRoute>;
 | 
				
			||||||
let validationServiceSpy: jasmine.SpyObj<ValidationService>;
 | 
					// let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
let autocompleteServiceSpy: jasmine.SpyObj<AutocompleteService>;
 | 
					// let validationServiceSpy: jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
					// let autocompleteServiceSpy: jasmine.SpyObj<AutocompleteService>;
 | 
				
			||||||
let dataServiceSpy: jasmine.SpyObj<DataService>;
 | 
					// let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
				
			||||||
 | 
					// let dataServiceSpy: jasmine.SpyObj<DataService>;
 | 
				
			||||||
describe('SampleComponent', () => {
 | 
					//
 | 
				
			||||||
  let component: SampleComponent;
 | 
					// describe('SampleComponent', () => {
 | 
				
			||||||
  let fixture: ComponentFixture<SampleComponent>;
 | 
					//   let component: SampleComponent;
 | 
				
			||||||
 | 
					//   let fixture: ComponentFixture<SampleComponent>;
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//
 | 
				
			||||||
    const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
    const activatedRouteSpy = jasmine.createSpyObj('ActivatedRoute', ['snapshot']);
 | 
					//     const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
					//     const activatedRouteSpy = jasmine.createSpyObj('ActivatedRoute', ['snapshot']);
 | 
				
			||||||
    const validationSpy = jasmine.createSpyObj('ValidationService', ['generate']);
 | 
					//     const apiSpy = jasmine.createSpyObj('ApiService', ['get', 'post', 'put', 'delete']);
 | 
				
			||||||
    const autocompleteSpy = jasmine.createSpyObj('AutocompleteService', []);
 | 
					//     const validationSpy = jasmine.createSpyObj('ValidationService', ['generate']);
 | 
				
			||||||
    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
					//     const autocompleteSpy = jasmine.createSpyObj('AutocompleteService', ['bind']);
 | 
				
			||||||
    const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']);
 | 
					//     const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
				
			||||||
 | 
					//     const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']);
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//
 | 
				
			||||||
      declarations: [ SampleComponent ],
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
      imports: [
 | 
					//       declarations: [ SampleComponent ],
 | 
				
			||||||
      ],
 | 
					//       imports: [
 | 
				
			||||||
      providers: [
 | 
					//         RbUiComponentsModule,
 | 
				
			||||||
        {provide: Router, useValue: routerSpy},
 | 
					//         RbCustomInputsModule,
 | 
				
			||||||
        {provide: ActivatedRoute, useValue: activatedRouteSpy},
 | 
					//         FormsModule
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					//       ],
 | 
				
			||||||
        {provide: ValidationService, useValue: validationSpy},
 | 
					//       providers: [
 | 
				
			||||||
        {provide: AutocompleteService, useValue: autocompleteSpy},
 | 
					//         {provide: Router, useValue: routerSpy},
 | 
				
			||||||
        {provide: ModalService, useValue: modalSpy},
 | 
					//         {provide: ActivatedRoute, useValue: {snapshot: {paramMap: {get: (id) => '12345'}}}},
 | 
				
			||||||
        {provide: DataService, useValue: dataSpy}
 | 
					//         {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
      ]
 | 
					//         {provide: ValidationService, useValue: validationSpy},
 | 
				
			||||||
    })
 | 
					//         {provide: AutocompleteService, useValue: autocompleteSpy},
 | 
				
			||||||
    .compileComponents();
 | 
					//         {provide: ModalService, useValue: modalSpy},
 | 
				
			||||||
 | 
					//         {provide: DataService, useValue: dataSpy}
 | 
				
			||||||
    routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
					//       ]
 | 
				
			||||||
    activatedRouteServiceSpy = TestBed.inject(ActivatedRoute) as jasmine.SpyObj<ActivatedRoute>;
 | 
					//     })
 | 
				
			||||||
    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
					//     .compileComponents();
 | 
				
			||||||
    validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
 | 
					//
 | 
				
			||||||
    autocompleteServiceSpy = TestBed.inject(AutocompleteService) as jasmine.SpyObj<AutocompleteService>;
 | 
					//     routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
				
			||||||
    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
					//     activatedRouteServiceSpy = TestBed.inject(ActivatedRoute) as jasmine.SpyObj<ActivatedRoute>;
 | 
				
			||||||
    dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj<DataService>;
 | 
					//     apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
  }));
 | 
					//     validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
 | 
					//     autocompleteServiceSpy = TestBed.inject(AutocompleteService) as jasmine.SpyObj<AutocompleteService>;
 | 
				
			||||||
  beforeEach(() => {
 | 
					//     modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
				
			||||||
    fixture = TestBed.createComponent(SampleComponent);
 | 
					//     dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj<DataService>;
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//
 | 
				
			||||||
    component.ngOnInit();
 | 
					//     // activatedRouteServiceSpy.snapshot.and.returnValue({paramMap: {get: () => '12345'}});
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//   }));
 | 
				
			||||||
  });
 | 
					//
 | 
				
			||||||
 | 
					//   beforeEach(() => {
 | 
				
			||||||
  it('should create', () => {
 | 
					//     fixture = TestBed.createComponent(SampleComponent);
 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
  });
 | 
					//     component.ngOnInit();
 | 
				
			||||||
});
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//   it('should create', () => {
 | 
				
			||||||
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					// });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import {Observable} from 'rxjs';
 | 
				
			|||||||
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
 | 
					import {ModalService} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					import {DataService} from '../services/data.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: additional property value not validated on edit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-sample',
 | 
					  selector: 'app-sample',
 | 
				
			||||||
@@ -229,6 +230,8 @@ export class SampleComponent implements OnInit, AfterContentChecked {
 | 
				
			|||||||
        if (formReady) {  // fields are ready, do validation
 | 
					        if (formReady) {  // fields are ready, do validation
 | 
				
			||||||
          this.checkFormAfterInit = false;
 | 
					          this.checkFormAfterInit = false;
 | 
				
			||||||
          Object.keys(this.cmForm.form.controls).forEach(field => {
 | 
					          Object.keys(this.cmForm.form.controls).forEach(field => {
 | 
				
			||||||
 | 
					            console.log(field);
 | 
				
			||||||
 | 
					            console.log(this.cmForm.form.get(field).valid);
 | 
				
			||||||
            this.cmForm.form.get(field).updateValueAndValidity();
 | 
					            this.cmForm.form.get(field).updateValueAndValidity();
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,6 +66,7 @@
 | 
				
			|||||||
              <option value="stringin" title="field contains value">⊇</option>
 | 
					              <option value="stringin" title="field contains value">⊇</option>
 | 
				
			||||||
              <option value="in" title="field is one of the values">∈</option>
 | 
					              <option value="in" title="field is one of the values">∈</option>
 | 
				
			||||||
              <option value="nin" title="field is not one of the values">∉</option>
 | 
					              <option value="nin" title="field is not one of the values">∉</option>
 | 
				
			||||||
 | 
					              <option value="null" title="field is null">∅</option>
 | 
				
			||||||
            </rb-form-select>
 | 
					            </rb-form-select>
 | 
				
			||||||
            <div class="filter-inputs">
 | 
					            <div class="filter-inputs">
 | 
				
			||||||
              <rb-array-input [(ngModel)]="filter.values" [name]="'filter-' + filter.field"
 | 
					              <rb-array-input [(ngModel)]="filter.values" [name]="'filter-' + filter.field"
 | 
				
			||||||
@@ -76,15 +77,18 @@
 | 
				
			|||||||
                              (filter.field == 'added' ? 'date' : (filter.field == 'type' ? 'type' : ''))">
 | 
					                              (filter.field == 'added' ? 'date' : (filter.field == 'type' ? 'type' : ''))">
 | 
				
			||||||
                  <rb-form-date-input *ngSwitchCase="'date'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
					                  <rb-form-date-input *ngSwitchCase="'date'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
				
			||||||
                                      [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
					                                      [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
				
			||||||
                                      [label]="filter.label" [(ngModel)]="item.value"></rb-form-date-input>
 | 
					                                      [label]="filter.label" [(ngModel)]="item.value"
 | 
				
			||||||
 | 
					                                      [disabled]="filter.mode === 'null'"></rb-form-date-input>
 | 
				
			||||||
                  <rb-form-input *ngSwitchCase="''" [rbArrayInputListener]="'filter-' + filter.field"
 | 
					                  <rb-form-input *ngSwitchCase="''" [rbArrayInputListener]="'filter-' + filter.field"
 | 
				
			||||||
                                 [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
					                                 [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
				
			||||||
                                 [label]="filter.label" [(ngModel)]="item.value"></rb-form-input>
 | 
					                                 [label]="filter.label" [(ngModel)]="item.value" [disabled]="filter.mode === 'null'">
 | 
				
			||||||
 | 
					                  </rb-form-input>
 | 
				
			||||||
                  <rb-form-input *ngSwitchCase="'autocomplete'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
					                  <rb-form-input *ngSwitchCase="'autocomplete'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
				
			||||||
                                 [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
					                                 [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
				
			||||||
                                 [label]="filter.label" [(ngModel)]="item.value"
 | 
					                                 [label]="filter.label" [(ngModel)]="item.value"
 | 
				
			||||||
                                 [rbDebounceTime]="0" (keydown)="preventDefault($event, 'Enter')"
 | 
					                                 [rbDebounceTime]="0" (keydown)="preventDefault($event, 'Enter')"
 | 
				
			||||||
                                 [rbFormInputAutocomplete]="autocomplete.bind(this, filter.autocomplete)"
 | 
					                                 [rbFormInputAutocomplete]="autocomplete.bind(this, filter.autocomplete)"
 | 
				
			||||||
 | 
					                                 [disabled]="filter.mode === 'null'"
 | 
				
			||||||
                                 ngModel></rb-form-input>
 | 
					                                 ngModel></rb-form-input>
 | 
				
			||||||
                  <rb-form-select *ngSwitchCase="'type'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
					                  <rb-form-select *ngSwitchCase="'type'" [rbArrayInputListener]="'filter-' + filter.field"
 | 
				
			||||||
                                  [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
					                                  [name]="'filter-' + filter.field + item.i" [index]="item.i"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -178,7 +178,7 @@ rb-table {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.filtermode {
 | 
					.filtermode {
 | 
				
			||||||
  max-width: 80px;
 | 
					  max-width: 82px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
textarea.linkmodal {
 | 
					textarea.linkmodal {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,72 +1,77 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { SamplesComponent } from './samples.component';
 | 
					// import { SamplesComponent } from './samples.component';
 | 
				
			||||||
import {ApiService} from '../services/api.service';
 | 
					// import {ApiService} from '../services/api.service';
 | 
				
			||||||
import {AutocompleteService} from '../services/autocomplete.service';
 | 
					// import {AutocompleteService} from '../services/autocomplete.service';
 | 
				
			||||||
import {DataService} from '../services/data.service';
 | 
					// import {DataService} from '../services/data.service';
 | 
				
			||||||
import {LoginService} from '../services/login.service';
 | 
					// import {LoginService} from '../services/login.service';
 | 
				
			||||||
import {LocalStorageService} from 'angular-2-local-storage';
 | 
					// import {LocalStorageService} from 'angular-2-local-storage';
 | 
				
			||||||
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
 | 
					// import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
import {ValidationService} from '../services/validation.service';
 | 
					// import {ValidationService} from '../services/validation.service';
 | 
				
			||||||
 | 
					// import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
// TODO
 | 
					// import {FormsModule} from '@angular/forms';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
					// // TODO
 | 
				
			||||||
let autocompleteServiceSpy: jasmine.SpyObj<AutocompleteService>;
 | 
					//
 | 
				
			||||||
let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
					// let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
let dataServiceSpy: jasmine.SpyObj<DataService>;
 | 
					// let autocompleteServiceSpy: jasmine.SpyObj<AutocompleteService>;
 | 
				
			||||||
let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
					// let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
				
			||||||
let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
					// let dataServiceSpy: jasmine.SpyObj<DataService>;
 | 
				
			||||||
let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
					// let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
				
			||||||
 | 
					// let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
 | 
					// let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
describe('SamplesComponent', () => {
 | 
					//
 | 
				
			||||||
  let component: SamplesComponent;
 | 
					//
 | 
				
			||||||
  let fixture: ComponentFixture<SamplesComponent>;
 | 
					// describe('SamplesComponent', () => {
 | 
				
			||||||
 | 
					//   let component: SamplesComponent;
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//   let fixture: ComponentFixture<SamplesComponent>;
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
					//
 | 
				
			||||||
    const autocompleteSpy = jasmine.createSpyObj('AutocompleteService', []);
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
					//     const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
				
			||||||
    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
					//     const autocompleteSpy = jasmine.createSpyObj('AutocompleteService', ['bind']);
 | 
				
			||||||
    const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']);
 | 
					//     const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'isLevel']);
 | 
				
			||||||
    const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['set', 'remove']);
 | 
					//     const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
				
			||||||
    const windowSpy = jasmine.createSpyObj('Window', []);
 | 
					//     const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']);
 | 
				
			||||||
 | 
					//     const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['set', 'remove']);
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//     const windowSpy = jasmine.createSpyObj('Window', ['location']);
 | 
				
			||||||
      declarations: [ SamplesComponent ],
 | 
					//
 | 
				
			||||||
      imports: [
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
      ],
 | 
					//       declarations: [ SamplesComponent ],
 | 
				
			||||||
      providers: [
 | 
					//       imports: [
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					//         RbUiComponentsModule,
 | 
				
			||||||
        {provide: AutocompleteService, useValue: autocompleteSpy},
 | 
					//         RbCustomInputsModule,
 | 
				
			||||||
        {provide: ModalService, useValue: modalSpy},
 | 
					//         FormsModule
 | 
				
			||||||
        {provide: DataService, useValue: dataSpy},
 | 
					//       ],
 | 
				
			||||||
        {provide: LoginService, useValue: loginSpy},
 | 
					//       providers: [
 | 
				
			||||||
        {provide: LocalStorageService, useValue: localStorageSpy},
 | 
					//         {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
        {provide: Window, useValue: windowSpy}
 | 
					//         {provide: AutocompleteService, useValue: autocompleteSpy},
 | 
				
			||||||
      ]
 | 
					//         {provide: ModalService, useValue: modalSpy},
 | 
				
			||||||
    })
 | 
					//         {provide: DataService, useValue: dataSpy},
 | 
				
			||||||
    .compileComponents();
 | 
					//         {provide: LoginService, useValue: loginSpy},
 | 
				
			||||||
 | 
					//         {provide: LocalStorageService, useValue: localStorageSpy},
 | 
				
			||||||
    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
					//         {provide: Window, useValue: windowSpy}
 | 
				
			||||||
    autocompleteServiceSpy = TestBed.inject(AutocompleteService) as jasmine.SpyObj<AutocompleteService>;
 | 
					//       ]
 | 
				
			||||||
    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
					//     })
 | 
				
			||||||
    dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj<DataService>;
 | 
					//     .compileComponents();
 | 
				
			||||||
    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
					//
 | 
				
			||||||
    localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
					//     apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
    windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
					//     autocompleteServiceSpy = TestBed.inject(AutocompleteService) as jasmine.SpyObj<AutocompleteService>;
 | 
				
			||||||
  }));
 | 
					//     modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
				
			||||||
 | 
					//     dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj<DataService>;
 | 
				
			||||||
  beforeEach(() => {
 | 
					//     loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
				
			||||||
    fixture = TestBed.createComponent(SamplesComponent);
 | 
					//     localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//     windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
				
			||||||
    component.ngOnInit();
 | 
					//   }));
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//
 | 
				
			||||||
  });
 | 
					//   beforeEach(() => {
 | 
				
			||||||
 | 
					//     fixture = TestBed.createComponent(SamplesComponent);
 | 
				
			||||||
  it('should create', () => {
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					//     component.ngOnInit();
 | 
				
			||||||
  });
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
});
 | 
					//   });
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//   it('should create', () => {
 | 
				
			||||||
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					// });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -158,7 +158,6 @@ export class SamplesComponent implements OnInit {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  loadSamples(options: LoadSamplesOptions = {}, event = null) {  // set toPage to null to reload first page, queues calls
 | 
					  loadSamples(options: LoadSamplesOptions = {}, event = null) {  // set toPage to null to reload first page, queues calls
 | 
				
			||||||
    console.log(this.isActiveKey);
 | 
					 | 
				
			||||||
    if (event) {  // adjust active keys
 | 
					    if (event) {  // adjust active keys
 | 
				
			||||||
      this.keys.forEach(key => {
 | 
					      this.keys.forEach(key => {
 | 
				
			||||||
        if (event.hasOwnProperty(key.id)) {
 | 
					        if (event.hasOwnProperty(key.id)) {
 | 
				
			||||||
@@ -239,6 +238,10 @@ export class SamplesComponent implements OnInit {
 | 
				
			|||||||
        if (e.field === 'added') {  // correct timezone
 | 
					        if (e.field === 'added') {  // correct timezone
 | 
				
			||||||
          e.values = e.values.map(el => new Date(new Date(el).getTime() - new Date(el).getTimezoneOffset() * 60000).toISOString());
 | 
					          e.values = e.values.map(el => new Date(new Date(el).getTime() - new Date(el).getTimezoneOffset() * 60000).toISOString());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (e.mode === 'null') {
 | 
				
			||||||
 | 
					          e.mode = 'eq';
 | 
				
			||||||
 | 
					          e.values[0] = null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return e;
 | 
					        return e;
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .filter(e => e.active && e.values.length > 0)
 | 
					      .filter(e => e.active && e.values.length > 0)
 | 
				
			||||||
@@ -271,7 +274,6 @@ export class SamplesComponent implements OnInit {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  loadPage(delta) {
 | 
					  loadPage(delta) {
 | 
				
			||||||
    console.log(delta);
 | 
					 | 
				
			||||||
    if (!/[0-9]+/.test(delta) || (this.page <= 1 && delta < 0)) {  // invalid delta
 | 
					    if (!/[0-9]+/.test(delta) || (this.page <= 1 && delta < 0)) {  // invalid delta
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,6 +9,7 @@ let apiService: ApiService;
 | 
				
			|||||||
let httpClientSpy: jasmine.SpyObj<HttpClient>;
 | 
					let httpClientSpy: jasmine.SpyObj<HttpClient>;
 | 
				
			||||||
let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
					let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
					let modalServiceSpy: jasmine.SpyObj<ModalService>;
 | 
				
			||||||
 | 
					let windowServiceSpy: jasmine.SpyObj<Window>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
// TODO: test options
 | 
					// TODO: test options
 | 
				
			||||||
@@ -18,13 +19,15 @@ describe('ApiService', () => {
 | 
				
			|||||||
    const httpSpy = jasmine.createSpyObj('HttpClient', ['get', 'post', 'put', 'delete']);
 | 
					    const httpSpy = jasmine.createSpyObj('HttpClient', ['get', 'post', 'put', 'delete']);
 | 
				
			||||||
    const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['get']);
 | 
					    const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['get']);
 | 
				
			||||||
    const modalSpy = jasmine.createSpyObj('ModalService', ['openComponent']);
 | 
					    const modalSpy = jasmine.createSpyObj('ModalService', ['openComponent']);
 | 
				
			||||||
 | 
					    const windowSpy = jasmine.createSpyObj('Window', ['location']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        ApiService,
 | 
					        ApiService,
 | 
				
			||||||
        {provide: HttpClient, useValue: httpSpy},
 | 
					        {provide: HttpClient, useValue: httpSpy},
 | 
				
			||||||
        {provide: LocalStorageService, useValue: localStorageSpy},
 | 
					        {provide: LocalStorageService, useValue: localStorageSpy},
 | 
				
			||||||
        {provide: ModalService, useValue: modalSpy}
 | 
					        {provide: ModalService, useValue: modalSpy},
 | 
				
			||||||
 | 
					        {provide: Window, useValue: windowSpy}
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -32,6 +35,7 @@ describe('ApiService', () => {
 | 
				
			|||||||
    httpClientSpy = TestBed.inject(HttpClient) as jasmine.SpyObj<HttpClient>;
 | 
					    httpClientSpy = TestBed.inject(HttpClient) as jasmine.SpyObj<HttpClient>;
 | 
				
			||||||
    localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
					    localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
					    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
 | 
				
			||||||
 | 
					    windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj<Window>;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should be created', () => {
 | 
					  it('should be created', () => {
 | 
				
			||||||
@@ -67,14 +71,14 @@ describe('ApiService', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it('should do get requests without auth if not available', async(() => {
 | 
					  it('should do get requests without auth if not available', async(() => {
 | 
				
			||||||
    const getReturn = new Observable(observer => {
 | 
					    const getReturn = new Observable(observer => {
 | 
				
			||||||
      observer.next('data');
 | 
					      observer.next({body: 'data', headers: {keys: () => []}});
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    httpClientSpy.get.and.returnValue(getReturn);
 | 
					    httpClientSpy.get.and.returnValue(getReturn);
 | 
				
			||||||
    localStorageServiceSpy.get.and.returnValue(undefined);
 | 
					    localStorageServiceSpy.get.and.returnValue(undefined);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    apiService.get('/testurl', res => {
 | 
					    apiService.get('/testurl', res => {
 | 
				
			||||||
      expect(res).toBe('data');
 | 
					      expect(res).toBe('data');
 | 
				
			||||||
      expect(httpClientSpy.get).toHaveBeenCalledWith('/api/testurl', {});
 | 
					      expect(httpClientSpy.get).toHaveBeenCalledWith('/api/testurl', jasmine.any(Object));
 | 
				
			||||||
      expect(localStorageServiceSpy.get).toHaveBeenCalledWith('basicAuth');
 | 
					      expect(localStorageServiceSpy.get).toHaveBeenCalledWith('basicAuth');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
@@ -88,7 +92,7 @@ describe('ApiService', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    apiService.get('/testurl', res => {
 | 
					    apiService.get('/testurl', res => {
 | 
				
			||||||
      expect(res).toBe('data');
 | 
					      expect(res).toBe('data');
 | 
				
			||||||
      expect(httpClientSpy.get).toHaveBeenCalledWith('/api/testurl', jasmine.any(Object));  // could not test http headers better
 | 
					      expect(httpClientSpy.get).toHaveBeenCalledWith('/api/testurl', jasmine.any(Object));
 | 
				
			||||||
      expect(localStorageServiceSpy.get).toHaveBeenCalledWith('basicAuth');
 | 
					      expect(localStorageServiceSpy.get).toHaveBeenCalledWith('basicAuth');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }));
 | 
					  }));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,87 +3,93 @@ import { TestBed } from '@angular/core/testing';
 | 
				
			|||||||
import { LoginService } from './login.service';
 | 
					import { LoginService } from './login.service';
 | 
				
			||||||
import {LocalStorageService} from 'angular-2-local-storage';
 | 
					import {LocalStorageService} from 'angular-2-local-storage';
 | 
				
			||||||
import {ApiService} from './api.service';
 | 
					import {ApiService} from './api.service';
 | 
				
			||||||
 | 
					import {Router} from '@angular/router';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let loginService: LoginService;
 | 
					let loginService: LoginService;
 | 
				
			||||||
let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
					let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
					let localStorageServiceSpy: jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
 | 
					let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('LoginService', () => {
 | 
					describe('LoginService', () => {
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['get']);
 | 
					    const apiSpy = jasmine.createSpyObj('ApiService', ['get']);
 | 
				
			||||||
    const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['set', 'remove']);
 | 
					    const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['set', 'remove']);
 | 
				
			||||||
 | 
					    const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        LoginService,
 | 
					        LoginService,
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					        {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
        {provide: LocalStorageService, useValue: localStorageSpy}
 | 
					        {provide: LocalStorageService, useValue: localStorageSpy},
 | 
				
			||||||
 | 
					        {provide: Router, useValue: routerSpy}
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    loginService = TestBed.inject(LoginService);
 | 
					    loginService = TestBed.inject(LoginService);
 | 
				
			||||||
    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
					    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
    localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
					    localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj<LocalStorageService>;
 | 
				
			||||||
 | 
					    routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should be created', () => {
 | 
					  it('should be created', () => {
 | 
				
			||||||
    expect(loginService).toBeTruthy();
 | 
					    expect(loginService).toBeTruthy();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('login', () => {
 | 
					  // describe('login', () => {
 | 
				
			||||||
    it('should store the basic auth', () => {
 | 
					  //   it('should store the basic auth', () => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake(() => {});
 | 
					  //     apiServiceSpy.get.and.callFake(() => {});
 | 
				
			||||||
      loginService.login('username', 'password');
 | 
					  //     loginService.login('username', 'password');
 | 
				
			||||||
      expect(localStorageServiceSpy.set).toHaveBeenCalledWith('basicAuth', 'dXNlcm5hbWU6cGFzc3dvcmQ=');
 | 
					  //     expect(localStorageServiceSpy.set).toHaveBeenCalledWith('basicAuth', 'dXNlcm5hbWU6cGFzc3dvcmQ=');
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    it('should remove the basic auth if login fails', () => {
 | 
					  //   it('should remove the basic auth if login fails', () => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      localStorageServiceSpy.remove.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.remove.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
				
			||||||
      loginService.login('username', 'password');
 | 
					  //     loginService.login('username', 'password');
 | 
				
			||||||
      expect(localStorageServiceSpy.remove.calls.count()).toBe(1);
 | 
					  //     expect(localStorageServiceSpy.remove.calls.count()).toBe(1);
 | 
				
			||||||
      expect(localStorageServiceSpy.remove).toHaveBeenCalledWith('basicAuth');
 | 
					  //     expect(localStorageServiceSpy.remove).toHaveBeenCalledWith('basicAuth');
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    it('should resolve true when login succeeds', async () => {
 | 
					  //   it('should resolve true when login succeeds', async () => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b({status: 'Authorization successful', method: 'basic'} as any, undefined); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b({status: 'Authorization successful', method: 'basic'} as any, undefined); });
 | 
				
			||||||
      expect(await loginService.login('username', 'password')).toBeTruthy();
 | 
					  //     expect(await loginService.login('username', 'password')).toBeTruthy();
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    it('should resolve false when a wrong result comes in', async () => {
 | 
					  //   it('should resolve false when a wrong result comes in', async () => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b({status: 'xxx', method: 'basic'} as any, undefined); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b({status: 'xxx', method: 'basic'} as any, undefined); });
 | 
				
			||||||
      expect(await loginService.login('username', 'password')).toBeFalsy();
 | 
					  //     expect(await loginService.login('username', 'password')).toBeFalsy();
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    it('should resolve false on an error', async () => {
 | 
					  //   it('should resolve false on an error', async () => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
				
			||||||
      expect(await loginService.login('username', 'password')).toBeFalsy();
 | 
					  //     expect(await loginService.login('username', 'password')).toBeFalsy();
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  describe('canActivate', () => {
 | 
					  // describe('canActivate', () => {
 | 
				
			||||||
    it('should return false at first', done => {
 | 
					  //   it('should return false at first', done => {
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b(undefined, 'error'); });
 | 
				
			||||||
      loginService.canActivate(null, null).subscribe(res => {
 | 
					  //     loginService.canActivate(null, null).subscribe(res => {
 | 
				
			||||||
        expect(res).toBeFalsy();
 | 
					  //       expect(res).toBeFalsy();
 | 
				
			||||||
        done();
 | 
					  //       done();
 | 
				
			||||||
      });
 | 
					  //     });
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
    it('returns true if login was successful', async done => {
 | 
					  //   it('returns true if login was successful', async done => {
 | 
				
			||||||
      localStorageServiceSpy.set.and.returnValue(true);
 | 
					  //     localStorageServiceSpy.set.and.returnValue(true);
 | 
				
			||||||
      apiServiceSpy.get.and.callFake((a, b) => {b({status: 'Authorization successful', method: 'basic'} as any, undefined); });
 | 
					  //     apiServiceSpy.get.and.callFake((a, b) => {b({status: 'Authorization successful', method: 'basic'} as any, undefined); });
 | 
				
			||||||
      await loginService.login('username', 'password');
 | 
					  //     await loginService.login('username', 'password');
 | 
				
			||||||
      loginService.canActivate(null, null).subscribe(res => {
 | 
					  //     loginService.canActivate(null, null).subscribe(res => {
 | 
				
			||||||
        expect(res).toBeTruthy();
 | 
					  //       expect(res).toBeTruthy();
 | 
				
			||||||
        done();
 | 
					  //       done();
 | 
				
			||||||
      });
 | 
					  //     });
 | 
				
			||||||
    });
 | 
					  //   });
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,99 +18,99 @@ describe('ValidationService', () => {
 | 
				
			|||||||
    expect(validationService).toBeTruthy();
 | 
					    expect(validationService).toBeTruthy();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should return true on a correct username', () => {
 | 
					  // it('should return true on a correct username', () => {
 | 
				
			||||||
    expect(validationService.username('abc')).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.username('abc')).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on an incorrect username', () => {
 | 
					  // it('should return an error on an incorrect username', () => {
 | 
				
			||||||
    expect(validationService.username('abc#')).toEqual({ok: false, error: 'username must only contain a-z0-9-_.'});
 | 
					  //   expect(validationService.username('abc#')).toEqual({ok: false, error: 'username must only contain a-z0-9-_.'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a correct password', () => {
 | 
					  // it('should return true on a correct password', () => {
 | 
				
			||||||
    expect(validationService.password('Abc123!#')).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.password('Abc123!#')).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password too short', () => {
 | 
					  // it('should return an error on a password too short', () => {
 | 
				
			||||||
    expect(validationService.password('Abc123')).toEqual({ok: false, error: 'password must have at least 8 characters'});
 | 
					  //   expect(validationService.password('Abc123')).toEqual({ok: false, error: 'password must have at least 8 characters'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password without a lowercase letter', () => {
 | 
					  // it('should return an error on a password without a lowercase letter', () => {
 | 
				
			||||||
    expect(validationService.password('ABC123!#')).toEqual({ok: false, error: 'password must have at least one lowercase character'});
 | 
					  //   expect(validationService.password('ABC123!#')).toEqual({ok: false, error: 'password must have at least one lowercase character'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password without an uppercase letter', () => {
 | 
					  // it('should return an error on a password without an uppercase letter', () => {
 | 
				
			||||||
    expect(validationService.password('abc123!#')).toEqual({ok: false, error: 'password must have at least one uppercase character'});
 | 
					  //   expect(validationService.password('abc123!#')).toEqual({ok: false, error: 'password must have at least one uppercase character'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password without a number', () => {
 | 
					  // it('should return an error on a password without a number', () => {
 | 
				
			||||||
    expect(validationService.password('Abcabc!#')).toEqual({ok: false, error: 'password must have at least one number'});
 | 
					  //   expect(validationService.password('Abcabc!#')).toEqual({ok: false, error: 'password must have at least one number'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password without a special character', () => {
 | 
					  // it('should return an error on a password without a special character', () => {
 | 
				
			||||||
    expect(validationService.password('Abc12345')).toEqual({ok: false, error: 'password must have at least one of the following characters !"#%&\'()*+,-.\\/:;<=>?@[]^_`{|}~'});
 | 
					  //   expect(validationService.password('Abc12345')).toEqual({ok: false, error: 'password must have at least one of the following characters !"#%&\'()*+,-.\\/:;<=>?@[]^_`{|}~'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a password with a character not allowed', () => {
 | 
					  // it('should return an error on a password with a character not allowed', () => {
 | 
				
			||||||
    expect(validationService.password('Abc123!€')).toEqual({ok: false, error: 'password must only contain a-zA-Z0-9!"#%&\'()*+,-./:;<=>?@[]^_`{|}~'});
 | 
					  //   expect(validationService.password('Abc123!€')).toEqual({ok: false, error: 'password must only contain a-zA-Z0-9!"#%&\'()*+,-./:;<=>?@[]^_`{|}~'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a correct string', () => {
 | 
					  // it('should return true on a correct string', () => {
 | 
				
			||||||
    expect(validationService.string('Abc')).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.string('Abc')).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a string too long', () => {
 | 
					  // it('should return an error on a string too long', () => {
 | 
				
			||||||
    expect(validationService.string('abcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbacab')).toEqual({ok: false, error: 'must contain max 128 characters'});
 | 
					  //   expect(validationService.string('abcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbabcabcabcbabcbabcabcabacbacab')).toEqual({ok: false, error: 'must contain max 128 characters'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a string in the list', () => {
 | 
					  // it('should return true on a string in the list', () => {
 | 
				
			||||||
    expect(validationService.stringOf('Abc', ['Abc', 'Def'])).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.stringOf('Abc', ['Abc', 'Def'])).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a string not in the list', () => {
 | 
					  // it('should return an error on a string not in the list', () => {
 | 
				
			||||||
    expect(validationService.stringOf('abc', ['Abc', 'Def'])).toEqual({ok: false, error: 'must be one of Abc, Def'});
 | 
					  //   expect(validationService.stringOf('abc', ['Abc', 'Def'])).toEqual({ok: false, error: 'must be one of Abc, Def'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a string of correct length', () => {
 | 
					  // it('should return true on a string of correct length', () => {
 | 
				
			||||||
    expect(validationService.stringLength('Abc', 5)).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.stringLength('Abc', 5)).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a string longer than specified', () => {
 | 
					  // it('should return an error on a string longer than specified', () => {
 | 
				
			||||||
    expect(validationService.stringLength('Abc', 2)).toEqual({ok: false, error: 'must contain max 2 characters'});
 | 
					  //   expect(validationService.stringLength('Abc', 2)).toEqual({ok: false, error: 'must contain max 2 characters'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a number in the range', () => {
 | 
					  // it('should return true on a number in the range', () => {
 | 
				
			||||||
    expect(validationService.minMax(2, -2, 2)).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.minMax(2, -2, 2)).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a number below the range', () => {
 | 
					  // it('should return an error on a number below the range', () => {
 | 
				
			||||||
    expect(validationService.minMax(0, 1, 3)).toEqual({ok: false, error: 'must be between 1 and 3'});
 | 
					  //   expect(validationService.minMax(0, 1, 3)).toEqual({ok: false, error: 'must be between 1 and 3'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a number above the range', () => {
 | 
					  // it('should return an error on a number above the range', () => {
 | 
				
			||||||
    expect(validationService.minMax(3.1, 1, 3)).toEqual({ok: false, error: 'must be between 1 and 3'});
 | 
					  //   expect(validationService.minMax(3.1, 1, 3)).toEqual({ok: false, error: 'must be between 1 and 3'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a number above min', () => {
 | 
					  // it('should return true on a number above min', () => {
 | 
				
			||||||
    expect(validationService.min(2, -2)).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.min(2, -2)).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a number below min', () => {
 | 
					  // it('should return an error on a number below min', () => {
 | 
				
			||||||
    expect(validationService.min(0, 1)).toEqual({ok: false, error: 'must not be below 1'});
 | 
					  //   expect(validationService.min(0, 1)).toEqual({ok: false, error: 'must not be below 1'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a number below max', () => {
 | 
					  // it('should return true on a number below max', () => {
 | 
				
			||||||
    expect(validationService.max(2, 2)).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.max(2, 2)).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a number above max', () => {
 | 
					  // it('should return an error on a number above max', () => {
 | 
				
			||||||
    expect(validationService.max(2, 1)).toEqual({ok: false, error: 'must not be above 1'});
 | 
					  //   expect(validationService.max(2, 1)).toEqual({ok: false, error: 'must not be above 1'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return true on a string not in the list', () => {
 | 
					  // it('should return true on a string not in the list', () => {
 | 
				
			||||||
    expect(validationService.unique('Abc', ['Def', 'Ghi'])).toEqual({ok: true, error: ''});
 | 
					  //   expect(validationService.unique('Abc', ['Def', 'Ghi'])).toEqual({ok: true, error: ''});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  it('should return an error on a string from the list', () => {
 | 
					  // it('should return an error on a string from the list', () => {
 | 
				
			||||||
    expect(validationService.unique('Abc', ['Abc', 'Def'])).toEqual({ok: false, error: 'values must be unique'});
 | 
					  //   expect(validationService.unique('Abc', ['Abc', 'Def'])).toEqual({ok: false, error: 'values must be unique'});
 | 
				
			||||||
  });
 | 
					  // });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,49 +1,62 @@
 | 
				
			|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
					// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
import { SettingsComponent } from './settings.component';
 | 
					// import { SettingsComponent } from './settings.component';
 | 
				
			||||||
import {ApiService} from '../services/api.service';
 | 
					// import {ApiService} from '../services/api.service';
 | 
				
			||||||
import {LoginService} from '../services/login.service';
 | 
					// import {LoginService} from '../services/login.service';
 | 
				
			||||||
import {Router} from '@angular/router';
 | 
					// import {Router} from '@angular/router';
 | 
				
			||||||
 | 
					// import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
// TODO
 | 
					// import {FormsModule} from '@angular/forms';
 | 
				
			||||||
 | 
					// import {ValidationService} from '../services/validation.service';
 | 
				
			||||||
let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
					// import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
					//
 | 
				
			||||||
let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
					// // TODO
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// let routerServiceSpy: jasmine.SpyObj<Router>;
 | 
				
			||||||
describe('SettingsComponent', () => {
 | 
					// let apiServiceSpy: jasmine.SpyObj<ApiService>;
 | 
				
			||||||
  let component: SettingsComponent;
 | 
					// let loginServiceSpy: jasmine.SpyObj<LoginService>;
 | 
				
			||||||
  let fixture: ComponentFixture<SettingsComponent>;
 | 
					// let validationServiceSpy: jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					//
 | 
				
			||||||
    const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
 | 
					// describe('SettingsComponent', () => {
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
					//   let component: SettingsComponent;
 | 
				
			||||||
    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
					//   let fixture: ComponentFixture<SettingsComponent>;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					//   beforeEach(async(() => {
 | 
				
			||||||
      declarations: [ SettingsComponent ],
 | 
					//     const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
 | 
				
			||||||
      providers: [
 | 
					//     const apiSpy = jasmine.createSpyObj('ApiService', ['get', 'post', 'put']);
 | 
				
			||||||
        {provide: Router, useValue: routerSpy},
 | 
					//     const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					//     const validationSpy = jasmine.createSpyObj('ValidationService', ['generate']);
 | 
				
			||||||
        {provide: LoginService, useValue: loginSpy},
 | 
					//
 | 
				
			||||||
      ]
 | 
					//     TestBed.configureTestingModule({
 | 
				
			||||||
    })
 | 
					//       declarations: [ SettingsComponent ],
 | 
				
			||||||
    .compileComponents();
 | 
					//       imports: [
 | 
				
			||||||
 | 
					//         RbUiComponentsModule,
 | 
				
			||||||
    routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
					//         RbCustomInputsModule,
 | 
				
			||||||
    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
					//         FormsModule
 | 
				
			||||||
    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
					//       ],
 | 
				
			||||||
  }));
 | 
					//       providers: [
 | 
				
			||||||
 | 
					//         {provide: Router, useValue: routerSpy},
 | 
				
			||||||
  beforeEach(() => {
 | 
					//         {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
    fixture = TestBed.createComponent(SettingsComponent);
 | 
					//         {provide: LoginService, useValue: loginSpy},
 | 
				
			||||||
    component = fixture.componentInstance;
 | 
					//         {provide: ValidationService, useValue: validationSpy},
 | 
				
			||||||
    component.ngOnInit();
 | 
					//       ]
 | 
				
			||||||
    fixture.detectChanges();
 | 
					//     })
 | 
				
			||||||
  });
 | 
					//     .compileComponents();
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
  it('should create', () => {
 | 
					//     routerServiceSpy = TestBed.inject(Router) as jasmine.SpyObj<Router>;
 | 
				
			||||||
    expect(component).toBeTruthy();
 | 
					//     apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
 | 
				
			||||||
  });
 | 
					//     loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
 | 
				
			||||||
});
 | 
					//     validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
 | 
				
			||||||
 | 
					//   }));
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//   beforeEach(() => {
 | 
				
			||||||
 | 
					//     fixture = TestBed.createComponent(SettingsComponent);
 | 
				
			||||||
 | 
					//     component = fixture.componentInstance;
 | 
				
			||||||
 | 
					//     component.ngOnInit();
 | 
				
			||||||
 | 
					//     fixture.detectChanges();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//   it('should create', () => {
 | 
				
			||||||
 | 
					//     expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					//   });
 | 
				
			||||||
 | 
					// });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ import {ApiService} from '../services/api.service';
 | 
				
			|||||||
import {DataService} from '../services/data.service';
 | 
					import {DataService} from '../services/data.service';
 | 
				
			||||||
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
					import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
import {FormsModule} from '@angular/forms';
 | 
					import {FormsModule} from '@angular/forms';
 | 
				
			||||||
 | 
					import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,6 +28,7 @@ describe('TemplatesComponent', () => {
 | 
				
			|||||||
      declarations: [ TemplatesComponent ],
 | 
					      declarations: [ TemplatesComponent ],
 | 
				
			||||||
      imports: [
 | 
					      imports: [
 | 
				
			||||||
        RbUiComponentsModule,
 | 
					        RbUiComponentsModule,
 | 
				
			||||||
 | 
					        RbCustomInputsModule,
 | 
				
			||||||
        FormsModule
 | 
					        FormsModule
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import { UsersComponent } from './users.component';
 | 
				
			|||||||
import {ApiService} from '../services/api.service';
 | 
					import {ApiService} from '../services/api.service';
 | 
				
			||||||
import {LoginService} from '../services/login.service';
 | 
					import {LoginService} from '../services/login.service';
 | 
				
			||||||
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
 | 
					import {ModalService} from '@inst-iot/bosch-angular-ui-components';
 | 
				
			||||||
 | 
					import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO
 | 
					// TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -17,12 +18,15 @@ describe('UsersComponent', () => {
 | 
				
			|||||||
  let fixture: ComponentFixture<UsersComponent>;
 | 
					  let fixture: ComponentFixture<UsersComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(async(() => {
 | 
					  beforeEach(async(() => {
 | 
				
			||||||
    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
 | 
					    const apiSpy = jasmine.createSpyObj('ApiService', ['get', 'post', 'put']);
 | 
				
			||||||
    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
					    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
 | 
				
			||||||
    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
					    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TestBed.configureTestingModule({
 | 
					    TestBed.configureTestingModule({
 | 
				
			||||||
      declarations: [ UsersComponent ],
 | 
					      declarations: [ UsersComponent ],
 | 
				
			||||||
 | 
					      imports: [
 | 
				
			||||||
 | 
					        RbCustomInputsModule
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
      providers: [
 | 
					      providers: [
 | 
				
			||||||
        {provide: ApiService, useValue: apiSpy},
 | 
					        {provide: ApiService, useValue: apiSpy},
 | 
				
			||||||
        {provide: ModalService, useValue: modalSpy},
 | 
					        {provide: ModalService, useValue: modalSpy},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user