fix(tests): fix tests

This commit is contained in:
vsavkin
2015-10-08 08:22:11 -07:00
parent 5458036de7
commit 8b725c77fd
26 changed files with 82 additions and 86 deletions
@@ -21,7 +21,7 @@ import {bind, Inject, Injector, LifeCycle} from 'angular2/core';
import {ExceptionHandler} from 'angular2/src/core/facade/exceptions';
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
import {IS_DART} from '../platform';
import {ComponentRef_} from "../../src/core/linker/dynamic_component_loader";
import {ComponentRef_} from "angular2/src/core/linker/dynamic_component_loader";
@Component({selector: 'hello-app'})
@View({template: '{{greeting}} world!'})
@@ -14,7 +14,7 @@ import {
inject
} from 'angular2/test_lib';
import {SpyChangeDetector} from '../spies';
import {LifeCycle_} from "../../../src/core/life_cycle/life_cycle";
import {LifeCycle_} from "angular2/src/core/life_cycle/life_cycle";
export function main() {
describe("LifeCycle", () => {
@@ -24,7 +24,7 @@ import {Compiler} from 'angular2/src/core/linker/compiler';
import {ProtoViewFactory} from 'angular2/src/core/linker/proto_view_factory';
import {reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection';
import {AppProtoView} from 'angular2/src/core/linker/view';
import {Compiler_} from "../../../src/core/linker/compiler";
import {Compiler_} from "angular2/src/core/linker/compiler";
export function main() {
describe('Compiler', () => {
@@ -37,8 +37,10 @@ export function main() {
protoViewFactorySpy = new SpyProtoViewFactory();
someProtoView = new AppProtoView(null, null, null, null, null, null);
protoViewFactorySpy.spy('createHost').andReturn(someProtoView);
return
[bind(ProtoViewFactory).toValue(protoViewFactorySpy), bind(Compiler).toClass(Compiler_)];
var factoryBinding = bind(ProtoViewFactory).toValue(protoViewFactorySpy);
var classBinding = bind(Compiler).toClass(Compiler_);
var bindings = [factoryBinding, classBinding];
return bindings;
});
beforeEach(inject([Compiler], (_compiler) => {
@@ -24,7 +24,7 @@ import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {DOCUMENT} from 'angular2/src/core/render/render';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {RootTestComponent_} from "../../../src/test_lib/test_component_builder";
import {RootTestComponent_} from "angular2/src/test_lib/test_component_builder";
export function main() {
describe('DynamicComponentLoader', function() {
@@ -39,7 +39,7 @@ import {
} from 'angular2/src/core/metadata';
import {OnDestroy} from 'angular2/lifecycle_hooks';
import {bind, Injector, Binding, Optional, Inject, Injectable, Self, SkipSelf, InjectMetadata, Host, HostMetadata, SkipSelfMetadata} from 'angular2/core';
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
import {ViewContainerRef, ViewContainerRef_} from 'angular2/src/core/linker/view_container_ref';
import {TemplateRef, TemplateRef_} from 'angular2/src/core/linker/template_ref';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';
@@ -905,7 +905,7 @@ export function main() {
it('should inject ViewContainerRef', () => {
var inj = injector(ListWrapper.concat([NeedsViewContainer], extraBindings));
expect(inj.get(NeedsViewContainer).viewContainer).toBeAnInstanceOf(ViewContainerRef);
expect(inj.get(NeedsViewContainer).viewContainer).toBeAnInstanceOf(ViewContainerRef_);
});
it("should inject TemplateRef", () => {
@@ -90,7 +90,7 @@ import {TemplateRef} from 'angular2/src/core/linker/template_ref';
import {DomRenderer} from 'angular2/src/core/render/dom/dom_renderer';
import {IS_DART} from '../../platform';
import {Compiler_} from "../../../src/core/linker/compiler";
import {Compiler_} from "angular2/src/core/linker/compiler";
const ANCHOR_ELEMENT = CONST_EXPR(new OpaqueToken('AnchorElement'));
@@ -1018,9 +1018,8 @@ export function main() {
}));
describe('dynamic ViewContainers', () => {
it('should allow to create a ViewContainerRef at any bound location',
inject([TestComponentBuilder, AsyncTestCompleter, bind(Compiler).toClass(Compiler_)],
inject([TestComponentBuilder, AsyncTestCompleter, Compiler],
(tcb: TestComponentBuilder, async, compiler) => {
tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
+2 -2
View File
@@ -1,7 +1,7 @@
import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detection';
import {ChangeDetectorRef_} from 'angular2/src/core/change_detection/change_detector_ref';
import {SpyObject, proxy} from 'angular2/test_lib';
export class SpyChangeDetectorRef extends SpyObject {
constructor() { super(ChangeDetectorRef); }
constructor() { super(ChangeDetectorRef_); }
}
@@ -108,7 +108,6 @@ class FakeEventManagerPlugin extends EventManagerPlugin {
class FakeNgZone extends NgZone_ {
constructor() { super({enableLongStackTrace: false}); }
run(fn) { fn(); }
runOutsideAngular(fn) { return fn(); }
+1 -1
View File
@@ -53,7 +53,7 @@ class SpyView extends SpyObject implements AppView {
}
@proxy
class SpyElementRef extends SpyObject implements ElementRef {
class SpyElementRef extends SpyObject implements ElementRef_ {
noSuchMethod(m) => super.noSuchMethod(m);
}
@@ -16,7 +16,8 @@ import {BrowserJsonp} from 'angular2/src/http/backends/browser_jsonp';
import {
JSONPConnection,
JSONPConnection_,
JSONPBackend
JSONPBackend,
JSONPBackend_
} from 'angular2/src/http/backends/jsonp_backend';
import {bind, Injector} from 'angular2/core';
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
@@ -74,7 +75,7 @@ export function main() {
bind(ResponseOptions)
.toClass(BaseResponseOptions),
bind(BrowserJsonp).toClass(MockBrowserJsonp),
JSONPBackend
bind(JSONPBackend).toClass(JSONPBackend_)
]);
backend = injector.get(JSONPBackend);
let base = new BaseRequestOptions();
@@ -32,7 +32,7 @@ import {
} from 'angular2/router';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {ComponentInstruction_} from "../../src/router/instruction";
import {ComponentInstruction_} from "angular2/src/router/instruction";
var dummyInstruction = new Instruction(new ComponentInstruction_('detail', [], null), null, {});
+2 -2
View File
@@ -1,7 +1,7 @@
import 'package:angular2/test_lib.dart' show SpyObject;
import 'package:angular2/core.dart' show LifeCycle, Injector, bind;
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
show ComponentRef;
show ComponentRef_;
import 'dart:js';
@proxy
@@ -10,7 +10,7 @@ class SpyLifeCycle extends SpyObject implements LifeCycle {
}
@proxy
class SpyComponentRef extends SpyObject implements ComponentRef {
class SpyComponentRef extends SpyObject implements ComponentRef_ {
Injector injector;
SpyComponentRef() {
@@ -38,7 +38,7 @@ import {
RenderFragmentRef,
Renderer
} from "angular2/src/core/render/api";
import {DomRenderer} from 'angular2/src/core/render/dom/dom_renderer';
import {DomRenderer, DomRenderer_} from 'angular2/src/core/render/dom/dom_renderer';
import {DefaultRenderView} from 'angular2/src/core/render/view';
import {
RenderProtoViewRefStore,
@@ -106,7 +106,8 @@ export function main() {
bind(RenderProtoViewRefStore)
.toValue(uiRenderProtoViewStore),
bind(RenderViewWithFragmentsStore).toValue(uiRenderViewStore),
bind(Renderer).toClass(DomRenderer)
bind(DomRenderer).toClass(DomRenderer_),
bind(Renderer).toAlias(DomRenderer)
]);
var uiSerializer = uiInjector.get(Serializer);
var domRenderer = uiInjector.get(DomRenderer);