/* * Copyright (C) 2018 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ActivatedRoute, RouterModule} from '@angular/router'; import {DataRoutingModule} from '../data-routing.module'; import {DataListComponent} from '../list/data-list.component'; import {DataDetailComponent} from './data-detail.component'; describe('DataDetailComponent', () => { let comp: DataDetailComponent; let fixture: ComponentFixture; let detailPage: HTMLElement; // @Component({ selector: 'stapps-data-list-item', template: '' }) // class DataListItemComponent { // @Input() item; // } const fakeActivatedRoute = { snapshot: { paramMap: { get: (url) => { return url; } } } } as ActivatedRoute; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [DataListComponent, DataDetailComponent], imports: [RouterModule, DataRoutingModule], providers: [{provide: ActivatedRoute, useValue: fakeActivatedRoute}], schemas: [CUSTOM_ELEMENTS_SCHEMA], }) .compileComponents(); })); beforeEach(async() => { fixture = await TestBed.createComponent(DataDetailComponent); comp = fixture.componentInstance; fixture.detectChanges(); }); it('should create component', () => expect(comp).toBeDefined(), ); it('should have apropriate title', () => { detailPage = fixture.nativeElement; const title: HTMLIonTitleElement | null = detailPage.querySelector('ion-title'); expect(title).not.toBe(null); expect(title!.innerText).toContain('Detailansicht'); }); });