style(compiler): reformat of codebase with new clang-format version (#36520)
This commit reformats the packages/compiler tree using the new version of clang-format. PR Close #36520
This commit is contained in:
@ -8,9 +8,11 @@
|
||||
|
||||
import {DirectiveResolver, ResourceLoader} from '@angular/compiler';
|
||||
import {Compiler, Component, Injector, NgModule, NgModuleFactory, ɵstringify as stringify} from '@angular/core';
|
||||
import {TestBed, async, fakeAsync, inject, tick} from '@angular/core/testing';
|
||||
import {async, fakeAsync, inject, TestBed, tick} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
|
||||
import {MockDirectiveResolver} from '../testing';
|
||||
|
||||
import {SpyResourceLoader} from './spies';
|
||||
|
||||
@Component({selector: 'child-cmp'})
|
||||
@ -27,11 +29,12 @@ class SomeCompWithUrlTemplate {
|
||||
|
||||
{
|
||||
describe('RuntimeCompiler', () => {
|
||||
|
||||
describe('compilerComponentSync', () => {
|
||||
describe('never resolving loader', () => {
|
||||
class StubResourceLoader {
|
||||
get(url: string) { return new Promise(() => {}); }
|
||||
get(url: string) {
|
||||
return new Promise(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@ -43,8 +46,8 @@ class SomeCompWithUrlTemplate {
|
||||
TestBed.configureTestingModule({declarations: [SomeCompWithUrlTemplate]});
|
||||
TestBed.compileComponents().then(() => {
|
||||
expect(() => TestBed.createComponent(SomeCompWithUrlTemplate))
|
||||
.toThrowError(
|
||||
`Can't compile synchronously as ${stringify(SomeCompWithUrlTemplate)} is still being loaded!`);
|
||||
.toThrowError(`Can't compile synchronously as ${
|
||||
stringify(SomeCompWithUrlTemplate)} is still being loaded!`);
|
||||
});
|
||||
}));
|
||||
|
||||
@ -55,15 +58,17 @@ class SomeCompWithUrlTemplate {
|
||||
TestBed.overrideComponent(SomeComp, {set: {template: '<child-cmp></child-cmp>'}});
|
||||
TestBed.compileComponents().then(() => {
|
||||
expect(() => TestBed.createComponent(SomeComp))
|
||||
.toThrowError(
|
||||
`Can't compile synchronously as ${stringify(ChildComp)} is still being loaded!`);
|
||||
.toThrowError(`Can't compile synchronously as ${
|
||||
stringify(ChildComp)} is still being loaded!`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolving loader', () => {
|
||||
class StubResourceLoader {
|
||||
get(url: string) { return Promise.resolve('hello'); }
|
||||
get(url: string) {
|
||||
return Promise.resolve('hello');
|
||||
}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@ -88,7 +93,9 @@ class SomeCompWithUrlTemplate {
|
||||
let dirResolver: MockDirectiveResolver;
|
||||
let injector: Injector;
|
||||
|
||||
beforeEach(() => { TestBed.configureCompiler({providers: [SpyResourceLoader.PROVIDE]}); });
|
||||
beforeEach(() => {
|
||||
TestBed.configureCompiler({providers: [SpyResourceLoader.PROVIDE]});
|
||||
});
|
||||
|
||||
beforeEach(fakeAsync(inject(
|
||||
[Compiler, ResourceLoader, DirectiveResolver, Injector],
|
||||
@ -110,7 +117,7 @@ class SomeCompWithUrlTemplate {
|
||||
}
|
||||
|
||||
resourceLoader.spy('get').and.callFake(() => Promise.resolve('hello'));
|
||||
let ngModuleFactory: NgModuleFactory<any> = undefined !;
|
||||
let ngModuleFactory: NgModuleFactory<any> = undefined!;
|
||||
compiler.compileModuleAsync(SomeModule).then((f) => ngModuleFactory = f);
|
||||
tick();
|
||||
expect(ngModuleFactory.moduleType).toBe(SomeModule);
|
||||
@ -126,8 +133,8 @@ class SomeCompWithUrlTemplate {
|
||||
|
||||
resourceLoader.spy('get').and.callFake(() => Promise.resolve(''));
|
||||
expect(() => compiler.compileModuleSync(SomeModule))
|
||||
.toThrowError(
|
||||
`Can't compile synchronously as ${stringify(SomeCompWithUrlTemplate)} is still being loaded!`);
|
||||
.toThrowError(`Can't compile synchronously as ${
|
||||
stringify(SomeCompWithUrlTemplate)} is still being loaded!`);
|
||||
});
|
||||
|
||||
it('should throw when using a templateUrl in a nested component that has not been compiled before',
|
||||
|
Reference in New Issue
Block a user