fix(platform-browser-dynamic): Rename CACHED_TEMPLATE_PROVIDER to RESOURCE_CACHE_PROVIDER (#10866)

* fix(platform-browser-dynamic): Rename CACHED_TEMPLATE_PROVIDER to RESOURCE_CACHE_PROVIDER

Closes #9741

BREAKING CHANGE:

`CACHED_TEMPLATE_PROVIDER` is now renamed to `RESOURCE_CACHE_PROVIDER`

Before:

```js
import {CACHED_TEMPLATE_PROVIDER} from '@angular/platform-browser-dynamic';
```

After:

```js
import {RESOURCE_CACHE_PROVIDER} from '@angular/platform-browser-dynamic';
```

* Rename XHR -> ResourceLoader
This commit is contained in:
Hans
2016-08-17 09:24:44 -07:00
committed by vikerman
parent 951ecb4d90
commit 40e160c22c
29 changed files with 213 additions and 190 deletions

View File

@ -31,7 +31,7 @@ export function setRootDomAdapter(adapter: DomAdapter) {
* Provides DOM operations in an environment-agnostic way.
*/
export abstract class DomAdapter {
public xhrType: Type<any> = null;
public resourceLoaderType: Type<any> = null;
abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean;
abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */;
abstract getProperty(el: Element, name: string): any;
@ -43,7 +43,7 @@ export abstract class DomAdapter {
abstract logGroupEnd(): any /** TODO #9100 */;
/** @deprecated */
getXHR(): Type<any> { return this.xhrType; }
getResourceLoader(): Type<any> { return this.resourceLoaderType; }
/**
* Maps attribute names to their corresponding property names for cases

View File

@ -50,7 +50,7 @@ export class WorkerDomAdapter extends DomAdapter {
getProperty(el: Element, name: string): any { throw 'not implemented'; }
invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; }
getXHR(): Type<any> { throw 'not implemented'; }
getResourceLoader(): Type<any> { throw 'not implemented'; }
get attrToPropMap(): {[key: string]: string} { throw 'not implemented'; }
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {XHR} from '@angular/compiler';
import {ResourceLoader} from '@angular/compiler';
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_INITIALIZER, Pipe, createPlatformFactory} from '@angular/core';
import {ApplicationRef, destroyPlatform} from '@angular/core/src/application_ref';
import {Console} from '@angular/core/src/console';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {CompilerConfig, XHR} from '@angular/compiler';
import {CompilerConfig, ResourceLoader} from '@angular/compiler';
import {CUSTOM_ELEMENTS_SCHEMA, Component, Directive, Injectable, Input, NgModule, Pipe} from '@angular/core';
import {TestBed, async, fakeAsync, inject, tick, withModule} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/matchers';
@ -368,10 +368,11 @@ export function main() {
describe('providers', () => {
beforeEach(() => {
let xhrGet =
jasmine.createSpy('xhrGet').and.returnValue(Promise.resolve('Hello world!'));
let resourceLoaderGet = jasmine.createSpy('resourceLoaderGet')
.and.returnValue(Promise.resolve('Hello world!'));
TestBed.configureTestingModule({declarations: [CompWithUrlTemplate]});
TestBed.configureCompiler({providers: [{provide: XHR, useValue: {get: xhrGet}}]});
TestBed.configureCompiler(
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
});
it('should use set up providers', fakeAsync(() => {
@ -480,10 +481,12 @@ export function main() {
});
describe('components', () => {
let xhrGet: jasmine.Spy;
let resourceLoaderGet: jasmine.Spy;
beforeEach(() => {
xhrGet = jasmine.createSpy('xhrGet').and.returnValue(Promise.resolve('Hello world!'));
TestBed.configureCompiler({providers: [{provide: XHR, useValue: {get: xhrGet}}]});
resourceLoaderGet = jasmine.createSpy('resourceLoaderGet')
.and.returnValue(Promise.resolve('Hello world!'));
TestBed.configureCompiler(
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
});
it('should report an error for declared components with templateUrl which never call TestBed.compileComponents',