mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
27 lines
855 B
TypeScript
27 lines
855 B
TypeScript
import {TestBed} from '@angular/core/testing';
|
|
import {TitleComponent} from './title.component';
|
|
|
|
describe('TitleComponent', () => {
|
|
beforeEach(async () => {
|
|
TestBed.configureTestingModule({declarations: [TitleComponent]});
|
|
await TestBed.compileComponents();
|
|
});
|
|
|
|
it('should create the component', () => {
|
|
const fixture = TestBed.createComponent(TitleComponent);
|
|
const titleComp = fixture.componentInstance;
|
|
|
|
expect(titleComp).toBeTruthy();
|
|
});
|
|
|
|
it('should render the title using the specified app name', () => {
|
|
const fixture = TestBed.createComponent(TitleComponent);
|
|
const titleComp = fixture.componentInstance;
|
|
const titleElem = fixture.nativeElement;
|
|
|
|
titleComp.appName = 'Test';
|
|
fixture.detectChanges();
|
|
|
|
expect(titleElem.querySelector('h1').textContent).toBe('Test app is running!');
|
|
});
|
|
});
|