angular/integration/cli-elements-universal/src/app/title.component.spec.ts
George Kalpakas 177eab2260 ci: add integration test for Angular Elemens with SSR (#40559)
This commit adds an integration test that uses `@angular/elements` with
`@angular/platform-server` in order to highlight a current
incompatibility. The issue will be fixed in a subsequent commit.

PR Close #40559
2021-02-12 08:55:25 -08:00

27 lines
859 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!');
});
});