feat(core): update reference and doc to change async
to waitAsync
. (#37583)
The last commit change `async` to `waitForAsync`. This commit update all usages in the code and also update aio doc. PR Close #37583
This commit is contained in:

committed by
Alex Rickabaugh

parent
8f074296c2
commit
8fbf40bf40
@ -8,7 +8,7 @@
|
||||
|
||||
import {ResourceLoader, UrlResolver} from '@angular/compiler';
|
||||
import {Component} from '@angular/core';
|
||||
import {async, fakeAsync, TestBed, tick} from '@angular/core/testing';
|
||||
import {fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing';
|
||||
import {CachedResourceLoader} from '@angular/platform-browser-dynamic/src/resource_loader/resource_loader_cache';
|
||||
import {setTemplateCache} from '@angular/platform-browser-dynamic/test/resource_loader/resource_loader_cache_setter';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
@ -29,14 +29,14 @@ if (isBrowser) {
|
||||
}).toThrowError('CachedResourceLoader: Template cache was not found in $templateCache.');
|
||||
});
|
||||
|
||||
it('should resolve the Promise with the cached file content on success', async(() => {
|
||||
it('should resolve the Promise with the cached file content on success', waitForAsync(() => {
|
||||
resourceLoader = createCachedResourceLoader();
|
||||
resourceLoader.get('test.html').then((text) => {
|
||||
expect(text).toBe('<div>Hello</div>');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should reject the Promise on failure', async(() => {
|
||||
it('should reject the Promise on failure', waitForAsync(() => {
|
||||
resourceLoader = createCachedResourceLoader();
|
||||
resourceLoader.get('unknown.html').then(() => {
|
||||
throw new Error('Not expected to succeed.');
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {ResourceLoader} from '@angular/compiler';
|
||||
import {Compiler, Component, NgModule} from '@angular/core';
|
||||
import {async, fakeAsync, inject, TestBed, tick} from '@angular/core/testing';
|
||||
import {fakeAsync, inject, TestBed, tick, waitForAsync} from '@angular/core/testing';
|
||||
import {ResourceLoaderImpl} from '@angular/platform-browser-dynamic/src/resource_loader/resource_loader_impl';
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ if (isBrowser) {
|
||||
expect(actuallyDone).toEqual(true);
|
||||
});
|
||||
|
||||
it('should run async tests with ResourceLoaders', async(() => {
|
||||
it('should run async tests with ResourceLoaders', waitForAsync(() => {
|
||||
const resourceLoader = new ResourceLoaderImpl();
|
||||
resourceLoader
|
||||
.get('/base/angular/packages/platform-browser/test/static_assets/test.html')
|
||||
@ -132,7 +132,7 @@ if (isBrowser) {
|
||||
it('should fail when an ResourceLoader fails', done => {
|
||||
const itPromise = patchJasmineIt();
|
||||
|
||||
it('should fail with an error from a promise', async(() => {
|
||||
it('should fail with an error from a promise', waitForAsync(() => {
|
||||
TestBed.configureTestingModule({declarations: [BadTemplateUrl]});
|
||||
TestBed.compileComponents();
|
||||
}));
|
||||
@ -151,7 +151,7 @@ if (isBrowser) {
|
||||
});
|
||||
|
||||
describe('TestBed createComponent', function() {
|
||||
it('should allow an external templateUrl', async(() => {
|
||||
it('should allow an external templateUrl', waitForAsync(() => {
|
||||
TestBed.configureTestingModule({declarations: [ExternalTemplateComp]});
|
||||
TestBed.compileComponents().then(() => {
|
||||
const componentFixture = TestBed.createComponent(ExternalTemplateComp);
|
||||
|
Reference in New Issue
Block a user