mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 21:43:04 +00:00
added error component and coverage for new components
This commit is contained in:
45
src/app/shared/loading/loading.component.spec.ts
Normal file
45
src/app/shared/loading/loading.component.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DebugElement } from '@angular/core';
|
||||
|
||||
import { LoadingComponent } from './loading.component';
|
||||
|
||||
describe('LoadingComponent (inline template)', () => {
|
||||
|
||||
let comp: LoadingComponent;
|
||||
let fixture: ComponentFixture<LoadingComponent>;
|
||||
let de: DebugElement;
|
||||
let el: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoadingComponent ], // declare the test component
|
||||
}).compileComponents(); // compile template and css
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoadingComponent);
|
||||
|
||||
comp = fixture.componentInstance; // LoadingComponent test instance
|
||||
|
||||
// query for the title <div> by CSS element selector
|
||||
de = fixture.debugElement.query(By.css('div'));
|
||||
el = de.nativeElement;
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(comp).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should display default message', () => {
|
||||
fixture.detectChanges();
|
||||
expect(el.textContent).toContain(comp.message);
|
||||
});
|
||||
|
||||
it('should display input message', () => {
|
||||
comp.message = 'Test Message';
|
||||
fixture.detectChanges();
|
||||
expect(el.textContent).toContain('Test Message');
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user