code improvements

This commit is contained in:
VLE2FE
2020-09-03 15:51:53 +02:00
parent 1440e9a6fc
commit c38d0be457
73 changed files with 276 additions and 1686 deletions

View File

@ -1,48 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ErrorComponent } from './error.component';
import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
import {By} from '@angular/platform-browser';
// TODO
describe('ErrorComponent', () => {
let component: ErrorComponent;
let fixture: ComponentFixture<ErrorComponent>;
let css; // get native element by css selector
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ErrorComponent ],
imports: [
RbUiComponentsModule,
],
providers: [
ModalService
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ErrorComponent);
component = fixture.componentInstance;
component.ngOnInit();
fixture.detectChanges();
css = (selector) => fixture.debugElement.query(By.css(selector)).nativeElement;
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should show the alert', () => {
expect(css('rb-alert')).toBeTruthy();
});
it('should have the right message', () => {
component.message = 'test';
fixture.detectChanges();
expect(css('.dialog-text').innerText).toBe('test');
});
});

View File

@ -7,8 +7,8 @@ import { Component, OnInit } from '@angular/core';
})
export class ErrorComponent implements OnInit {
message = '';
details: string[] = [];
message = ''; // main error message
details: string[] = []; // array of error detail paragraphs
constructor() { }