* The app shows the component vorgang (app-vorgang)
* Note: app.component.spec.ts now needs a stub for app-vorgang
<h1>{{title}}</h1>
+<app-vorgang></app-vorgang>
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
+import {Component} from '@angular/core';
+
+@Component({selector: 'app-vorgang', template: ''})
+class VorgangStubComponent {}
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
- AppComponent
+ AppComponent,
+ VorgangStubComponent
],
}).compileComponents();
}));
-<p>vorgang works!</p>
+<p>{{vorgang}}</p>
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should render vorgang', () => {
+ const fixture = TestBed.createComponent(VorgangComponent);
+ fixture.detectChanges();
+ const compiled = fixture.debugElement.nativeElement;
+ expect(compiled.querySelector('p').textContent).toContain('Hello world!');
+ });
});
})
export class VorgangComponent implements OnInit {
+ vorgang = "Hello world!";
+
constructor() { }
ngOnInit(): void {