chore: clang-format after various changes.
This commit is contained in:
parent
713e6d4aff
commit
365be6a309
@ -18,4 +18,4 @@ export {ROUTER_PROVIDERS} from './src/alt_router/router_providers';
|
|||||||
import {RouterOutlet} from './src/alt_router/directives/router_outlet';
|
import {RouterOutlet} from './src/alt_router/directives/router_outlet';
|
||||||
import {RouterLink} from './src/alt_router/directives/router_link';
|
import {RouterLink} from './src/alt_router/directives/router_link';
|
||||||
|
|
||||||
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/ [RouterOutlet, RouterLink];
|
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/[RouterOutlet, RouterLink];
|
||||||
|
@ -38,10 +38,10 @@ import {XHR} from 'angular2/compiler';
|
|||||||
/**
|
/**
|
||||||
* An array of providers that should be passed into `application()` when bootstrapping a component.
|
* An array of providers that should be passed into `application()` when bootstrapping a component.
|
||||||
*/
|
*/
|
||||||
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ [
|
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
|
||||||
BROWSER_APP_COMMON_PROVIDERS,
|
BROWSER_APP_COMMON_PROVIDERS,
|
||||||
COMPILER_PROVIDERS,
|
COMPILER_PROVIDERS,
|
||||||
/*@ts2dart_Provider*/{provide: XHR, useClass: XHRImpl},
|
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function browserPlatform(): PlatformRef {
|
export function browserPlatform(): PlatformRef {
|
||||||
|
@ -53,24 +53,24 @@ export const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
/*@ts2dart_const*/ [
|
/*@ts2dart_const*/[
|
||||||
/*@ts2dart_Provider*/{provide: APP_ID, useValue: 'a'},
|
/*@ts2dart_Provider*/ {provide: APP_ID, useValue: 'a'},
|
||||||
ELEMENT_PROBE_PROVIDERS,
|
ELEMENT_PROBE_PROVIDERS,
|
||||||
/*@ts2dart_Provider*/{provide: DirectiveResolver, useClass: MockDirectiveResolver},
|
/*@ts2dart_Provider*/ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
|
||||||
/*@ts2dart_Provider*/{provide: ViewResolver, useClass: MockViewResolver},
|
/*@ts2dart_Provider*/ {provide: ViewResolver, useClass: MockViewResolver},
|
||||||
Log,
|
Log,
|
||||||
TestComponentBuilder,
|
TestComponentBuilder,
|
||||||
/*@ts2dart_Provider*/{provide: NgZone, useFactory: createNgZone},
|
/*@ts2dart_Provider*/ {provide: NgZone, useFactory: createNgZone},
|
||||||
/*@ts2dart_Provider*/{provide: LocationStrategy, useClass: MockLocationStrategy},
|
/*@ts2dart_Provider*/ {provide: LocationStrategy, useClass: MockLocationStrategy},
|
||||||
/*@ts2dart_Provider*/{provide: AnimationBuilder, useClass: MockAnimationBuilder},
|
/*@ts2dart_Provider*/ {provide: AnimationBuilder, useClass: MockAnimationBuilder},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default application providers for testing without a compiler.
|
* Default application providers for testing without a compiler.
|
||||||
*/
|
*/
|
||||||
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
/*@ts2dart_const*/ [
|
/*@ts2dart_const*/[
|
||||||
BROWSER_APP_COMMON_PROVIDERS,
|
BROWSER_APP_COMMON_PROVIDERS,
|
||||||
/*@ts2dart_Provider*/{provide: XHR, useClass: XHRImpl},
|
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
|
||||||
ADDITIONAL_TEST_BROWSER_PROVIDERS
|
ADDITIONAL_TEST_BROWSER_PROVIDERS
|
||||||
];
|
];
|
||||||
|
@ -39,23 +39,24 @@ function _createCompilerConfig() {
|
|||||||
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
|
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
|
||||||
* template compilation.
|
* template compilation.
|
||||||
*/
|
*/
|
||||||
export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> = /*@ts2dart_const*/ [
|
export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> =
|
||||||
Lexer,
|
/*@ts2dart_const*/[
|
||||||
Parser,
|
Lexer,
|
||||||
HtmlParser,
|
Parser,
|
||||||
TemplateParser,
|
HtmlParser,
|
||||||
DirectiveNormalizer,
|
TemplateParser,
|
||||||
CompileMetadataResolver,
|
DirectiveNormalizer,
|
||||||
DEFAULT_PACKAGE_URL_PROVIDER,
|
CompileMetadataResolver,
|
||||||
StyleCompiler,
|
DEFAULT_PACKAGE_URL_PROVIDER,
|
||||||
ViewCompiler,
|
StyleCompiler,
|
||||||
/*@ts2dart_Provider*/{provide: CompilerConfig, useFactory: _createCompilerConfig, deps: []},
|
ViewCompiler,
|
||||||
RuntimeCompiler,
|
/*@ts2dart_Provider*/ {provide: CompilerConfig, useFactory: _createCompilerConfig, deps: []},
|
||||||
/*@ts2dart_Provider*/{provide: ComponentResolver, useExisting: RuntimeCompiler},
|
RuntimeCompiler,
|
||||||
DomElementSchemaRegistry,
|
/*@ts2dart_Provider*/ {provide: ComponentResolver, useExisting: RuntimeCompiler},
|
||||||
/*@ts2dart_Provider*/{provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
|
DomElementSchemaRegistry,
|
||||||
UrlResolver,
|
/*@ts2dart_Provider*/ {provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
|
||||||
ViewResolver,
|
UrlResolver,
|
||||||
DirectiveResolver,
|
ViewResolver,
|
||||||
PipeResolver
|
DirectiveResolver,
|
||||||
];
|
PipeResolver
|
||||||
|
];
|
||||||
|
@ -437,10 +437,8 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||||||
export const PLATFORM_CORE_PROVIDERS =
|
export const PLATFORM_CORE_PROVIDERS =
|
||||||
/*@ts2dart_const*/[
|
/*@ts2dart_const*/[
|
||||||
PlatformRef_,
|
PlatformRef_,
|
||||||
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
|
/*@ts2dart_const*/ (
|
||||||
provide: PlatformRef,
|
/* @ts2dart_Provider */ {provide: PlatformRef, useExisting: PlatformRef_})
|
||||||
useExisting: PlatformRef_
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ export class ComponentRef_ extends ComponentRef {
|
|||||||
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
||||||
}
|
}
|
||||||
|
|
||||||
const EMPTY_CONTEXT = /*@ts2dart_const*/new Object();
|
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
|
||||||
|
|
||||||
/*@ts2dart_const*/
|
/*@ts2dart_const*/
|
||||||
export class ComponentFactory {
|
export class ComponentFactory {
|
||||||
|
@ -54,10 +54,10 @@ export const BROWSER_PLATFORM_MARKER =
|
|||||||
*
|
*
|
||||||
* Used automatically by `bootstrap`, or can be passed to {@link platform}.
|
* Used automatically by `bootstrap`, or can be passed to {@link platform}.
|
||||||
*/
|
*/
|
||||||
export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ [
|
export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
|
||||||
/*@ts2dart_Provider*/{provide: BROWSER_PLATFORM_MARKER, useValue: true},
|
/*@ts2dart_Provider*/ {provide: BROWSER_PLATFORM_MARKER, useValue: true},
|
||||||
PLATFORM_COMMON_PROVIDERS,
|
PLATFORM_COMMON_PROVIDERS,
|
||||||
/*@ts2dart_Provider*/{provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
|
/*@ts2dart_Provider*/ {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
|
||||||
];
|
];
|
||||||
|
|
||||||
function _exceptionHandler(): ExceptionHandler {
|
function _exceptionHandler(): ExceptionHandler {
|
||||||
@ -99,7 +99,7 @@ export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
|
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
|
||||||
/*@ts2dart_const*/ [/*@ts2dart_Provider*/{provide: XHR, useClass: CachedXHR}];
|
/*@ts2dart_const*/[/*@ts2dart_Provider*/ {provide: XHR, useClass: CachedXHR}];
|
||||||
|
|
||||||
export function initDomAdapter() {
|
export function initDomAdapter() {
|
||||||
BrowserDomAdapter.makeCurrent();
|
BrowserDomAdapter.makeCurrent();
|
||||||
|
@ -37,10 +37,8 @@ export const WORKER_APP_PLATFORM_MARKER =
|
|||||||
export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> =
|
export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> =
|
||||||
/*@ts2dart_const*/[
|
/*@ts2dart_const*/[
|
||||||
PLATFORM_COMMON_PROVIDERS,
|
PLATFORM_COMMON_PROVIDERS,
|
||||||
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
|
/*@ts2dart_const*/ (
|
||||||
provide: WORKER_APP_PLATFORM_MARKER,
|
/* @ts2dart_Provider */ {provide: WORKER_APP_PLATFORM_MARKER, useValue: true})
|
||||||
useValue: true
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =
|
export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =
|
||||||
|
@ -31,10 +31,8 @@ import {PlatformLocation} from 'angular2/platform/common';
|
|||||||
*/
|
*/
|
||||||
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
|
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
|
||||||
ROUTER_PROVIDERS_COMMON,
|
ROUTER_PROVIDERS_COMMON,
|
||||||
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
|
/*@ts2dart_const*/ (
|
||||||
provide: PlatformLocation,
|
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: BrowserPlatformLocation}),
|
||||||
useClass: BrowserPlatformLocation
|
|
||||||
}),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,29 +251,32 @@ export function main() {
|
|||||||
expect(car).toBe(sportsCar);
|
expect(car).toBe(sportsCar);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support multiProviders', () => {
|
it(
|
||||||
var injector = createInjector([
|
'should support multiProviders', () => {
|
||||||
|
var injector = createInjector([
|
||||||
Engine,
|
Engine,
|
||||||
/* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true},
|
/* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true},
|
||||||
/* @ts2dart_Provider */ {provide: Car, useClass: CarWithOptionalEngine, multi: true}
|
/* @ts2dart_Provider */ {provide: Car, useClass: CarWithOptionalEngine, multi: true}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
var cars = injector.get(Car);
|
||||||
|
expect(cars.length).toEqual(2);
|
||||||
|
expect(cars[0]).toBeAnInstanceOf(SportsCar);
|
||||||
|
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should support multiProviders that are created using useExisting', () => {
|
||||||
|
var injector = createInjector([
|
||||||
|
Engine,
|
||||||
|
SportsCar,
|
||||||
|
/* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}
|
||||||
|
]);
|
||||||
|
|
||||||
var cars = injector.get(Car);
|
var cars = injector.get(Car);
|
||||||
expect(cars.length).toEqual(2);
|
expect(cars.length).toEqual(1);
|
||||||
expect(cars[0]).toBeAnInstanceOf(SportsCar);
|
expect(cars[0]).toBe(injector.get(SportsCar));
|
||||||
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support multiProviders that are created using useExisting',
|
|
||||||
() => {
|
|
||||||
var injector = createInjector(
|
|
||||||
[Engine, SportsCar, /* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}]);
|
|
||||||
|
|
||||||
var cars = injector.get(Car);
|
|
||||||
expect(cars.length).toEqual(1);
|
|
||||||
expect(cars[0]).toBe(injector.get(SportsCar));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw when the aliased provider does not exist', () => {
|
it('should throw when the aliased provider does not exist', () => {
|
||||||
var injector = createInjector([provide('car', {useExisting: SportsCar})]);
|
var injector = createInjector([provide('car', {useExisting: SportsCar})]);
|
||||||
var e = `No provider for ${stringify(SportsCar)}! (car -> ${stringify(SportsCar)})`;
|
var e = `No provider for ${stringify(SportsCar)}! (car -> ${stringify(SportsCar)})`;
|
||||||
@ -513,118 +516,111 @@ export function main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('resolve', () => {
|
describe('resolve',
|
||||||
it('should resolve and flatten', () => {
|
() => {
|
||||||
var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]);
|
it('should resolve and flatten', () => {
|
||||||
providers.forEach(function(b) {
|
var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]);
|
||||||
if (isBlank(b)) return; // the result is a sparse array
|
providers.forEach(function(b) {
|
||||||
expect(b instanceof ResolvedReflectiveProvider_).toBe(true);
|
if (isBlank(b)) return; // the result is a sparse array
|
||||||
});
|
expect(b instanceof ResolvedReflectiveProvider_).toBe(true);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("should support multi providers", () => {
|
it("should support multi providers",
|
||||||
var provider = ReflectiveInjector.resolve([
|
() => {
|
||||||
|
var provider = ReflectiveInjector.resolve([
|
||||||
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
|
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
|
||||||
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
|
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
|
||||||
])[0];
|
])[0];
|
||||||
|
|
||||||
expect(provider.key.token).toBe(Engine);
|
expect(provider.key.token).toBe(Engine);
|
||||||
expect(provider.multiProvider).toEqual(true);
|
expect(provider.multiProvider).toEqual(true);
|
||||||
expect(provider.resolvedFactories.length).toEqual(2);
|
expect(provider.resolvedFactories.length).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("should support providers as hash", () => {
|
it("should support providers as hash",
|
||||||
var provider = ReflectiveInjector.resolve([
|
() => {
|
||||||
|
var provider = ReflectiveInjector.resolve([
|
||||||
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
|
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
|
||||||
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
|
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
|
||||||
])[0];
|
])[0];
|
||||||
|
|
||||||
expect(provider.key.token).toBe(Engine);
|
expect(provider.key.token).toBe(Engine);
|
||||||
expect(provider.multiProvider).toEqual(true);
|
expect(provider.multiProvider).toEqual(true);
|
||||||
expect(provider.resolvedFactories.length).toEqual(2);
|
expect(provider.resolvedFactories.length).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should support multi providers with only one provider", () => {
|
it("should support multi providers with only one provider", () => {
|
||||||
var provider = ReflectiveInjector.resolve([
|
var provider = ReflectiveInjector.resolve([
|
||||||
/* @ts2dart_Provider */ {
|
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}
|
||||||
provide: Engine,
|
])[0];
|
||||||
useClass: BrokenEngine,
|
|
||||||
multi: true
|
|
||||||
}
|
|
||||||
])[0];
|
|
||||||
|
|
||||||
expect(provider.key.token).toBe(Engine);
|
expect(provider.key.token).toBe(Engine);
|
||||||
expect(provider.multiProvider).toEqual(true);
|
expect(provider.multiProvider).toEqual(true);
|
||||||
expect(provider.resolvedFactories.length).toEqual(1);
|
expect(provider.resolvedFactories.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw when mixing multi providers with regular providers",
|
it("should throw when mixing multi providers with regular providers", () => {
|
||||||
() => {
|
expect(() => {
|
||||||
expect(() => {
|
ReflectiveInjector.resolve([
|
||||||
ReflectiveInjector.resolve([
|
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
|
||||||
/* @ts2dart_Provider */ {
|
Engine
|
||||||
provide: Engine,
|
]);
|
||||||
useClass: BrokenEngine,
|
}).toThrowErrorWith("Cannot mix multi providers and regular providers");
|
||||||
multi: true
|
|
||||||
},
|
|
||||||
Engine
|
|
||||||
]);
|
|
||||||
})
|
|
||||||
.toThrowErrorWith(
|
|
||||||
"Cannot mix multi providers and regular providers");
|
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
ReflectiveInjector.resolve(
|
ReflectiveInjector.resolve(
|
||||||
[Engine, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}]);
|
[Engine, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}]);
|
||||||
})
|
}).toThrowErrorWith("Cannot mix multi providers and regular providers");
|
||||||
.toThrowErrorWith(
|
});
|
||||||
"Cannot mix multi providers and regular providers");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should resolve forward references', () => {
|
it('should resolve forward references', () => {
|
||||||
var providers = ReflectiveInjector.resolve([
|
var providers = ReflectiveInjector.resolve([
|
||||||
forwardRef(() => Engine),
|
forwardRef(() => Engine),
|
||||||
[provide(forwardRef(() => BrokenEngine), {useClass: forwardRef(() => Engine)})],
|
[provide(forwardRef(() => BrokenEngine), {useClass: forwardRef(() => Engine)})],
|
||||||
provide(forwardRef(() => String),
|
provide(forwardRef(() => String),
|
||||||
{useFactory: () => 'OK', deps: [forwardRef(() => Engine)]})
|
{useFactory: () => 'OK', deps: [forwardRef(() => Engine)]})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var engineProvider = providers[0];
|
var engineProvider = providers[0];
|
||||||
var brokenEngineProvider = providers[1];
|
var brokenEngineProvider = providers[1];
|
||||||
var stringProvider = providers[2];
|
var stringProvider = providers[2];
|
||||||
|
|
||||||
expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
|
expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
|
||||||
expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
|
expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine)
|
||||||
expect(stringProvider.resolvedFactories[0].dependencies[0].key)
|
.toBe(true);
|
||||||
.toEqual(ReflectiveKey.get(Engine));
|
expect(stringProvider.resolvedFactories[0].dependencies[0].key)
|
||||||
});
|
.toEqual(ReflectiveKey.get(Engine));
|
||||||
|
});
|
||||||
|
|
||||||
it('should support overriding factory dependencies with dependency annotations', () => {
|
it('should support overriding factory dependencies with dependency annotations',
|
||||||
var providers = ReflectiveInjector.resolve([
|
() => {
|
||||||
provide("token",
|
var providers = ReflectiveInjector.resolve([
|
||||||
{
|
provide(
|
||||||
useFactory: (e) => "result",
|
"token",
|
||||||
deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]]
|
{
|
||||||
})
|
useFactory: (e) => "result",
|
||||||
]);
|
deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]]
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
var provider = providers[0];
|
var provider = providers[0];
|
||||||
|
|
||||||
expect(provider.resolvedFactories[0].dependencies[0].key.token).toEqual("dep");
|
expect(provider.resolvedFactories[0].dependencies[0].key.token).toEqual("dep");
|
||||||
expect(provider.resolvedFactories[0].dependencies[0].properties)
|
expect(provider.resolvedFactories[0].dependencies[0].properties)
|
||||||
.toEqual([new CustomDependencyMetadata()]);
|
.toEqual([new CustomDependencyMetadata()]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow declaring dependencies with flat arrays', () => {
|
it('should allow declaring dependencies with flat arrays', () => {
|
||||||
var resolved = ReflectiveInjector.resolve(
|
var resolved = ReflectiveInjector.resolve(
|
||||||
[provide('token', {useFactory: e => e, deps: [new InjectMetadata("dep")]})]);
|
[provide('token', {useFactory: e => e, deps: [new InjectMetadata("dep")]})]);
|
||||||
var nestedResolved = ReflectiveInjector.resolve(
|
var nestedResolved = ReflectiveInjector.resolve(
|
||||||
[provide('token', {useFactory: e => e, deps: [[new InjectMetadata("dep")]]})]);
|
[provide('token', {useFactory: e => e, deps: [[new InjectMetadata("dep")]]})]);
|
||||||
expect(resolved[0].resolvedFactories[0].dependencies[0].key.token)
|
expect(resolved[0].resolvedFactories[0].dependencies[0].key.token)
|
||||||
.toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token);
|
.toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("displayName", () => {
|
describe("displayName", () => {
|
||||||
it("should work", () => {
|
it("should work", () => {
|
||||||
|
@ -1071,7 +1071,7 @@ export function main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const ALL_DIRECTIVES = /*@ts2dart_const*/ [
|
const ALL_DIRECTIVES = /*@ts2dart_const*/[
|
||||||
forwardRef(() => TestDirective),
|
forwardRef(() => TestDirective),
|
||||||
forwardRef(() => TestComponent),
|
forwardRef(() => TestComponent),
|
||||||
forwardRef(() => AnotherComponent),
|
forwardRef(() => AnotherComponent),
|
||||||
@ -1084,7 +1084,7 @@ const ALL_DIRECTIVES = /*@ts2dart_const*/ [
|
|||||||
forwardRef(() => OrderCheckDirective1),
|
forwardRef(() => OrderCheckDirective1),
|
||||||
];
|
];
|
||||||
|
|
||||||
const ALL_PIPES = /*@ts2dart_const*/ [
|
const ALL_PIPES = /*@ts2dart_const*/[
|
||||||
forwardRef(() => CountingPipe),
|
forwardRef(() => CountingPipe),
|
||||||
forwardRef(() => CountingImpurePipe),
|
forwardRef(() => CountingImpurePipe),
|
||||||
forwardRef(() => MultiArgPipe),
|
forwardRef(() => MultiArgPipe),
|
||||||
|
@ -2273,11 +2273,7 @@ class PublicApi {
|
|||||||
@Directive({
|
@Directive({
|
||||||
selector: '[public-api]',
|
selector: '[public-api]',
|
||||||
providers: [
|
providers: [
|
||||||
/* @ts2dart_Provider */ {
|
/* @ts2dart_Provider */ {provide: PublicApi, useExisting: PrivateImpl, deps: []}
|
||||||
provide: PublicApi,
|
|
||||||
useExisting: PrivateImpl,
|
|
||||||
deps: []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -2379,10 +2375,8 @@ class DirectiveProvidingInjectableInView {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'directive-providing-injectable',
|
selector: 'directive-providing-injectable',
|
||||||
providers:
|
providers: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
|
||||||
[/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
|
viewProviders: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
|
||||||
viewProviders:
|
|
||||||
[/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
|
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -2433,10 +2427,7 @@ class EventBus {
|
|||||||
@Directive({
|
@Directive({
|
||||||
selector: 'grand-parent-providing-event-bus',
|
selector: 'grand-parent-providing-event-bus',
|
||||||
providers: [
|
providers: [
|
||||||
/* @ts2dart_Provider */ {
|
/* @ts2dart_Provider */ {provide: EventBus, useValue: new EventBus(null, "grandparent")}
|
||||||
provide: EventBus,
|
|
||||||
useValue: new EventBus(null, "grandparent")
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class GrandParentProvidingEventBus {
|
class GrandParentProvidingEventBus {
|
||||||
|
@ -49,7 +49,7 @@ import {
|
|||||||
import {NgIf} from 'angular2/common';
|
import {NgIf} from 'angular2/common';
|
||||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||||
|
|
||||||
const ALL_DIRECTIVES = /*@ts2dart_const*/ [
|
const ALL_DIRECTIVES = /*@ts2dart_const*/[
|
||||||
forwardRef(() => SimpleDirective),
|
forwardRef(() => SimpleDirective),
|
||||||
forwardRef(() => CycleDirective),
|
forwardRef(() => CycleDirective),
|
||||||
forwardRef(() => SimpleComponent),
|
forwardRef(() => SimpleComponent),
|
||||||
@ -83,7 +83,7 @@ const ALL_DIRECTIVES = /*@ts2dart_const*/ [
|
|||||||
NgIf
|
NgIf
|
||||||
];
|
];
|
||||||
|
|
||||||
const ALL_PIPES = /*@ts2dart_const*/ [
|
const ALL_PIPES = /*@ts2dart_const*/[
|
||||||
forwardRef(() => PipeNeedsChangeDetectorRef),
|
forwardRef(() => PipeNeedsChangeDetectorRef),
|
||||||
forwardRef(() => PipeNeedsService),
|
forwardRef(() => PipeNeedsService),
|
||||||
forwardRef(() => PurePipe),
|
forwardRef(() => PurePipe),
|
||||||
|
@ -64,24 +64,25 @@ function stripModulePrefix(relativePath: string): string {
|
|||||||
|
|
||||||
function getSourceTree(options: AngularBuilderOptions) {
|
function getSourceTree(options: AngularBuilderOptions) {
|
||||||
var tsInputTree = modulesFunnel(
|
var tsInputTree = modulesFunnel(
|
||||||
[
|
[
|
||||||
'tsconfig-ts2dart.json',
|
'tsconfig-ts2dart.json',
|
||||||
'upgrade-ts2dart.d.ts',
|
'upgrade-ts2dart.d.ts',
|
||||||
'zone-ts2dart.d.ts',
|
'zone-ts2dart.d.ts',
|
||||||
'**/*.js',
|
'**/*.js',
|
||||||
'**/*.ts',
|
'**/*.ts',
|
||||||
'**/*.dart'
|
'**/*.dart'
|
||||||
], [
|
],
|
||||||
'rollup-test/**/*',
|
[
|
||||||
'angular1_router/**/*',
|
'rollup-test/**/*',
|
||||||
'angular2/upgrade/**/*',
|
'angular1_router/**/*',
|
||||||
'angular2/core/test/typings.d.ts',
|
'angular2/upgrade/**/*',
|
||||||
'angular2/manual_typings/globals.d.ts',
|
'angular2/core/test/typings.d.ts',
|
||||||
'angular2/typings/es6-collections/es6-collections.d.ts',
|
'angular2/manual_typings/globals.d.ts',
|
||||||
'angular2/typings/es6-promise/es6-promise.d.ts',
|
'angular2/typings/es6-collections/es6-collections.d.ts',
|
||||||
'angular2/typings/tsd.d.ts',
|
'angular2/typings/es6-promise/es6-promise.d.ts',
|
||||||
'angular2/typings.d.ts',
|
'angular2/typings/tsd.d.ts',
|
||||||
]);
|
'angular2/typings.d.ts',
|
||||||
|
]);
|
||||||
var transpiled = ts2dart(tsInputTree, {
|
var transpiled = ts2dart(tsInputTree, {
|
||||||
generateLibraryName: true,
|
generateLibraryName: true,
|
||||||
generateSourceMap: false,
|
generateSourceMap: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user