fix(tests): fix tests
This commit is contained in:
@@ -29,7 +29,7 @@ import {
|
||||
} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||
import {Renderer} from 'angular2/src/core/render/api';
|
||||
import {DomRenderer, DOCUMENT} from 'angular2/src/core/render/render';
|
||||
import {DomRenderer, DomRenderer_, DOCUMENT} from 'angular2/src/core/render/render';
|
||||
import {
|
||||
SharedStylesHost,
|
||||
DomSharedStylesHost
|
||||
@@ -55,7 +55,7 @@ export function applicationDomBindings(): Array<Type | Binding | any[]> {
|
||||
new Binding(EVENT_MANAGER_PLUGINS, {toClass: DomEventsPlugin, multi: true}),
|
||||
new Binding(EVENT_MANAGER_PLUGINS, {toClass: KeyEventsPlugin, multi: true}),
|
||||
new Binding(EVENT_MANAGER_PLUGINS, {toClass: HammerGesturesPlugin, multi: true}),
|
||||
DomRenderer,
|
||||
bind(DomRenderer).toClass(DomRenderer_),
|
||||
bind(Renderer).toAlias(DomRenderer),
|
||||
DomSharedStylesHost,
|
||||
bind(SharedStylesHost).toAlias(DomSharedStylesHost),
|
||||
|
||||
@@ -74,7 +74,7 @@ function _componentBindings(appComponentType: Type): Array<Type | Binding | any[
|
||||
return componentRef;
|
||||
});
|
||||
},
|
||||
[bind(DynamicComponentLoader).toClass(DynamicComponentLoader_), Injector]),
|
||||
[DynamicComponentLoader, Injector]),
|
||||
|
||||
bind(appComponentType)
|
||||
.toFactory((p: Promise<any>) => p.then(ref => ref.instance), [APP_COMPONENT_REF_PROMISE]),
|
||||
|
||||
@@ -10,7 +10,7 @@ import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
export abstract class RuntimeCompiler extends Compiler {}
|
||||
|
||||
@Injectable()
|
||||
export class RuntimeCompiler_ extends Compiler_ {
|
||||
export class RuntimeCompiler_ extends Compiler_ implements RuntimeCompiler {
|
||||
constructor(_protoViewFactory: ProtoViewFactory, private _templateCompiler: TemplateCompiler) {
|
||||
super(_protoViewFactory);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ export class CyclicDependencyError extends AbstractBindingError {
|
||||
* ```
|
||||
*/
|
||||
export abstract class InstantiationError extends WrappedException {
|
||||
constructor(message, originalException, originalStack, context) {
|
||||
super(message, originalException, originalStack, context);
|
||||
}
|
||||
abstract addKey(injector: Injector, key: Key): void;
|
||||
get wrapperMessage(): string { return unimplemented(); };
|
||||
get causeKey(): Key { return unimplemented(); };
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
BindingWithVisibility,
|
||||
DependencyProvider
|
||||
} from 'angular2/src/core/di/injector';
|
||||
import {resolveBinding, ResolvedFactory} from 'angular2/src/core/di/binding';
|
||||
import {resolveBinding, ResolvedFactory, ResolvedBinding_} from 'angular2/src/core/di/binding';
|
||||
|
||||
import {AttributeMetadata, QueryMetadata} from '../metadata/di';
|
||||
|
||||
@@ -53,7 +53,6 @@ import {PipeBinding} from '../pipes/pipe_binding';
|
||||
|
||||
import {LifecycleHooks} from './interfaces';
|
||||
import {ViewContainerRef_} from "./view_container_ref";
|
||||
import {ResolvedBinding_} from "../di/binding";
|
||||
|
||||
var _staticKeys;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {BaseException, unimplemented} from 'angular2/src/core/facade/exceptions';
|
||||
import {ViewRef, ViewRef_} from './view_ref';
|
||||
import {RenderViewRef, RenderElementRef, Renderer} from 'angular2/src/core/render/api';
|
||||
import {ChangeDetectorRef} from "../change_detection/change_detector_ref";
|
||||
|
||||
/**
|
||||
* Represents a location in a View that has an injection, change-detection and render context
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {Type} from 'angular2/src/core/facade/lang';
|
||||
import {ResolvedFactory, resolveBinding} from 'angular2/src/core/di/binding';
|
||||
import {ResolvedFactory, resolveBinding, ResolvedBinding_} from 'angular2/src/core/di/binding';
|
||||
import {Key, ResolvedBinding, Binding} from 'angular2/src/core/di';
|
||||
import {PipeMetadata} from '../metadata/directives';
|
||||
import {ResolvedBinding_} from "../di/binding";
|
||||
|
||||
export class PipeBinding extends ResolvedBinding_ {
|
||||
constructor(public name: string, public pure: boolean, key: Key,
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import {Type, isPresent, isFunction, global, stringify} from 'angular2/src/core/facade/lang';
|
||||
import {
|
||||
Type,
|
||||
isPresent,
|
||||
isFunction,
|
||||
global,
|
||||
stringify,
|
||||
ConcreteType
|
||||
} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
import {PlatformReflectionCapabilities} from 'platform_reflection_capabilities';
|
||||
import {ConcreteType} from "../facade/lang";
|
||||
|
||||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
private _reflect: any;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {global, Type, isFunction, stringify} from 'angular2/src/core/facade/lang';
|
||||
import {ConcreteType} from "../facade/lang";
|
||||
import {ConcreteType, global, Type, isFunction, stringify} from 'angular2/src/core/facade/lang';
|
||||
|
||||
/**
|
||||
* Declares the interface to be used with {@link Class}.
|
||||
|
||||
@@ -293,3 +293,7 @@ class NgZone {
|
||||
zoneValues: {'_innerZone': true});
|
||||
}
|
||||
}
|
||||
|
||||
class NgZone_ extends NgZone {
|
||||
NgZone_({bool enableLongStackTrace}) : super(enableLongStackTrace: enableLongStackTrace);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {isBlank, isPresent, Type} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
|
||||
import {Directive, Attribute} from 'angular2/src/core/metadata';
|
||||
@@ -12,7 +12,6 @@ import {ComponentInstruction, RouteParams} from './instruction';
|
||||
import {ROUTE_DATA} from './route_data';
|
||||
import * as hookMod from './lifecycle_annotations';
|
||||
import {hasLifecycleHook} from './route_lifecycle_reflector';
|
||||
import {Type} from "../core/facade/lang";
|
||||
|
||||
let _resolveToTrue = PromiseWrapper.resolve(true);
|
||||
|
||||
@@ -25,59 +24,14 @@ let _resolveToTrue = PromiseWrapper.resolve(true);
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
export abstract class RouterOutlet {
|
||||
name: string = null;
|
||||
|
||||
/**
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `onActivate` hook of its child.
|
||||
*/
|
||||
abstract activate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
abstract reuse(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} when an outlet reuses a component across navigations.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
abstract deactivate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `canDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
abstract canDeactivate(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `canReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
abstract canReuse(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
@Directive({selector: 'router-outlet'})
|
||||
export class RouterOutlet_ extends RouterOutlet {
|
||||
export class RouterOutlet {
|
||||
name: string = null;
|
||||
private _componentRef: ComponentRef = null;
|
||||
private _currentInstruction: ComponentInstruction = null;
|
||||
|
||||
constructor(private _elementRef: ElementRef, private _loader: DynamicComponentLoader,
|
||||
private _parentRouter: routerMod.Router, @Attribute('name') nameAttr: string) {
|
||||
super();
|
||||
if (isPresent(nameAttr)) {
|
||||
this.name = nameAttr;
|
||||
this._parentRouter.registerAuxOutlet(this);
|
||||
@@ -86,6 +40,10 @@ export class RouterOutlet_ extends RouterOutlet {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `onActivate` hook of its child.
|
||||
*/
|
||||
activate(nextInstruction: ComponentInstruction): Promise<any> {
|
||||
var previousInstruction = this._currentInstruction;
|
||||
this._currentInstruction = nextInstruction;
|
||||
@@ -107,6 +65,11 @@ export class RouterOutlet_ extends RouterOutlet {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
reuse(nextInstruction: ComponentInstruction): Promise<any> {
|
||||
var previousInstruction = this._currentInstruction;
|
||||
this._currentInstruction = nextInstruction;
|
||||
@@ -120,6 +83,10 @@ export class RouterOutlet_ extends RouterOutlet {
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} when an outlet reuses a component across navigations.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
deactivate(nextInstruction: ComponentInstruction): Promise<any> {
|
||||
var next = _resolveToTrue;
|
||||
if (isPresent(this._componentRef) && isPresent(this._currentInstruction) &&
|
||||
@@ -135,6 +102,14 @@ export class RouterOutlet_ extends RouterOutlet {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `canDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
canDeactivate(nextInstruction: ComponentInstruction): Promise<boolean> {
|
||||
if (isBlank(this._currentInstruction)) {
|
||||
return _resolveToTrue;
|
||||
@@ -146,6 +121,16 @@ export class RouterOutlet_ extends RouterOutlet {
|
||||
return _resolveToTrue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `canReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
canReuse(nextInstruction: ComponentInstruction): Promise<boolean> {
|
||||
var result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user