mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
In the context of AOT tests, component with defer blocks no longer throw on instanciation if the component is not overridden (with `overrideComponent`) Prior to this change, all components with a `@defer` block would throw if `compileComponents` was not invoked. In none-JIT apps, this change makes `compileComponents()` uneccesary.
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
import {provideHttpClient} from '@angular/common/http';
|
|
import {provideHttpClientTesting} from '@angular/common/http/testing';
|
|
import {TestBed} from '@angular/core/testing';
|
|
import {Search, WINDOW} from '@angular/docs';
|
|
import {provideRouter, withComponentInputBinding} from '@angular/router';
|
|
import {AppComponent} from './app.component';
|
|
import {routes} from './routing/routes';
|
|
|
|
describe('AppComponent', () => {
|
|
const fakeSearch = {};
|
|
const fakeWindow = {location: {hostname: 'angular.dev'}};
|
|
|
|
it('should create the app', () => {
|
|
TestBed.configureTestingModule({
|
|
imports: [AppComponent],
|
|
providers: [
|
|
provideHttpClient(),
|
|
provideHttpClientTesting(),
|
|
provideRouter(routes, withComponentInputBinding()),
|
|
{
|
|
provide: WINDOW,
|
|
useValue: fakeWindow,
|
|
},
|
|
{
|
|
provide: Search,
|
|
useValue: fakeSearch,
|
|
},
|
|
],
|
|
});
|
|
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
const app = fixture.componentInstance;
|
|
expect(app).toBeTruthy();
|
|
});
|
|
});
|