mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { TestBed } from '@angular/core/testing';
|
|
import { By } from '@angular/platform-browser';
|
|
import { RouterTestingModule } from '@angular/router/testing';
|
|
import { AppComponent } from './app.component';
|
|
|
|
describe('AppComponent', () => {
|
|
beforeEach(async () => {
|
|
TestBed.configureTestingModule({
|
|
declarations: [
|
|
AppComponent,
|
|
TestTitleComponent,
|
|
],
|
|
imports: [
|
|
RouterTestingModule,
|
|
],
|
|
});
|
|
await TestBed.compileComponents();
|
|
});
|
|
|
|
it('should create the app', () => {
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
const appComp = fixture.componentInstance;
|
|
|
|
expect(appComp).toBeTruthy();
|
|
expect(appComp.title).toBe('cli-elements-universal');
|
|
});
|
|
|
|
it('should pass the app title to the `TitleComponent`', () => {
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
const titleDebugElement = fixture.debugElement.query(By.directive(TestTitleComponent));
|
|
const titleComp: TestTitleComponent = titleDebugElement.componentInstance;
|
|
|
|
fixture.detectChanges();
|
|
|
|
expect(titleComp).toBeTruthy();
|
|
expect(titleComp.appName).toBe('cli-elements-universal');
|
|
});
|
|
|
|
// Helpers
|
|
@Component({
|
|
selector: 'app-title-ce',
|
|
template: '',
|
|
})
|
|
class TestTitleComponent {
|
|
@Input() appName = '';
|
|
}
|
|
});
|