From: Kai Moritz Date: Fri, 26 Jun 2020 11:33:49 +0000 (+0200) Subject: Show component vorgang X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=b4b42f22c5320db3f9634889a3254a250a7746f5;p=examples%2Fangular-tour-of-heroes Show component vorgang * The app shows the component vorgang (app-vorgang) * Note: app.component.spec.ts now needs a stub for app-vorgang --- diff --git a/src/app/app.component.html b/src/app/app.component.html index 6213adc..307b719 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1,2 @@

{{title}}

+ diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 1933668..f98a32f 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,11 +1,16 @@ 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(); })); diff --git a/src/app/vorgang/vorgang.component.html b/src/app/vorgang/vorgang.component.html index d5c622f..759f83b 100644 --- a/src/app/vorgang/vorgang.component.html +++ b/src/app/vorgang/vorgang.component.html @@ -1 +1 @@ -

vorgang works!

+

{{vorgang}}

diff --git a/src/app/vorgang/vorgang.component.spec.ts b/src/app/vorgang/vorgang.component.spec.ts index 5623c20..6d671fc 100644 --- a/src/app/vorgang/vorgang.component.spec.ts +++ b/src/app/vorgang/vorgang.component.spec.ts @@ -22,4 +22,11 @@ describe('VorgangComponent', () => { 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!'); + }); }); diff --git a/src/app/vorgang/vorgang.component.ts b/src/app/vorgang/vorgang.component.ts index 4c8233d..ddcfe43 100644 --- a/src/app/vorgang/vorgang.component.ts +++ b/src/app/vorgang/vorgang.component.ts @@ -7,6 +7,8 @@ import { Component, OnInit } from '@angular/core'; }) export class VorgangComponent implements OnInit { + vorgang = "Hello world!"; + constructor() { } ngOnInit(): void {