removed circular deps so tests run on node

This commit is contained in:
vsavkin 2015-03-17 16:18:54 -07:00
parent b92d16c08e
commit 99f2d7faf6
4 changed files with 17 additions and 18 deletions

View File

@ -1,11 +1,11 @@
import {int, isBlank, BaseException} from 'angular2/src/facade/lang';
import {ProtoElementInjector} from './element_injector';
import * as eiModule from './element_injector';
import {DirectiveMetadata} from './directive_metadata';
import {List, StringMap} from 'angular2/src/facade/collection';
import {ProtoView} from './view';
export class ElementBinder {
protoElementInjector:ProtoElementInjector;
protoElementInjector:eiModule.ProtoElementInjector;
componentDirective:DirectiveMetadata;
viewportDirective:DirectiveMetadata;
textNodeIndices:List<int>;
@ -18,7 +18,7 @@ export class ElementBinder {
distanceToParent:int;
constructor(
index:int, parent:ElementBinder, distanceToParent: int,
protoElementInjector: ProtoElementInjector, componentDirective:DirectiveMetadata,
protoElementInjector: eiModule.ProtoElementInjector, componentDirective:DirectiveMetadata,
viewportDirective:DirectiveMetadata) {
if (isBlank(index)) {
throw new BaseException('null index not allowed.');

View File

@ -9,7 +9,7 @@ import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {NgElement} from 'angular2/src/core/dom/element';
import {Directive, onChange, onDestroy} from 'angular2/src/core/annotations/annotations';
import {BindingPropagationConfig} from 'angular2/src/core/compiler/binding_propagation_config';
import {PrivateComponentLocation} from 'angular2/src/core/compiler/private_component_location';
import * as pclModule from 'angular2/src/core/compiler/private_component_location';
import {reflector} from 'angular2/src/reflection/reflection';
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
@ -33,7 +33,7 @@ class StaticKeys {
this.ngElementId = Key.get(NgElement).id;
this.viewContainerId = Key.get(ViewContainer).id;
this.bindingPropagationConfigId = Key.get(BindingPropagationConfig).id;
this.privateComponentLocationId = Key.get(PrivateComponentLocation).id;
this.privateComponentLocationId = Key.get(pclModule.PrivateComponentLocation).id;
}
static instance() {
@ -603,7 +603,7 @@ export class ElementInjector extends TreeNode {
if (keyId === staticKeys.bindingPropagationConfigId) return this._preBuiltObjects.bindingPropagationConfig;
if (keyId === staticKeys.privateComponentLocationId) {
return new PrivateComponentLocation(this, this._preBuiltObjects.element, this._preBuiltObjects.view);
return new pclModule.PrivateComponentLocation(this, this._preBuiltObjects.element, this._preBuiltObjects.view);
}
//TODO add other objects as needed

View File

@ -1,7 +1,7 @@
import {Directive} from 'angular2/src/core/annotations/annotations'
import {NgElement} from 'angular2/src/core/dom/element';
import {ElementInjector} from './element_injector';
import {ProtoView, View} from './view';
import * as viewModule from './view';
import * as eiModule from './element_injector';
import {ShadowDomStrategy} from './shadow_dom_strategy';
import {EventManager} from 'angular2/src/core/events/event_manager';
import {ListWrapper} from 'angular2/src/facade/collection';
@ -9,17 +9,17 @@ import {Type} from 'angular2/src/facade/lang';
export class PrivateComponentLocation {
_elementInjector:ElementInjector;
_elementInjector:eiModule.ElementInjector;
_elt:NgElement;
_view:View;
_view:viewModule.View;
constructor(elementInjector:ElementInjector, elt:NgElement, view:View){
constructor(elementInjector:eiModule.ElementInjector, elt:NgElement, view:viewModule.View){
this._elementInjector = elementInjector;
this._elt = elt;
this._view = view;
}
createComponent(type:Type, annotation:Directive, componentProtoView:ProtoView,
createComponent(type:Type, annotation:Directive, componentProtoView:viewModule.ProtoView,
eventManager:EventManager, shadowDomStrategy:ShadowDomStrategy) {
var context = this._elementInjector.createPrivateComponent(type, annotation);

View File

@ -21,7 +21,7 @@ import {Lexer, Parser, dynamicChangeDetection,
import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
import {ShadowDomStrategy, NativeShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
import {ShadowDomStrategy, EmulatedUnscopedShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
import {PrivateComponentLocation} from 'angular2/src/core/compiler/private_component_location';
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
import {TemplateLoader} from 'angular2/src/core/compiler/template_loader';
@ -67,7 +67,7 @@ export function main() {
directiveMetadataReader = new DirectiveMetadataReader();
var urlResolver = new UrlResolver();
shadowDomStrategy = new NativeShadowDomStrategy(new StyleUrlResolver(urlResolver));
shadowDomStrategy = new EmulatedUnscopedShadowDomStrategy(new StyleUrlResolver(urlResolver), null);
compiler = createCompiler(tplResolver, dynamicChangeDetection);
});
@ -247,7 +247,7 @@ export function main() {
cd.detectChanges();
expect(view.nodes[0].shadowRoot.childNodes[0].nodeValue).toEqual('hello');
expect(view.nodes).toHaveText('hello');
async.done();
});
}));
@ -301,12 +301,12 @@ export function main() {
ctx.ctxProp = 'some_id';
cd.detectChanges();
expect(view.nodes[0].id).toEqual('some_id');
expect(DOM.getInnerHTML(view.nodes[0].shadowRoot.childNodes[0])).toEqual('Matched on id with some_id');
expect(view.nodes).toHaveText('Matched on id with some_id');
ctx.ctxProp = 'other_id';
cd.detectChanges();
expect(view.nodes[0].id).toEqual('other_id');
expect(DOM.getInnerHTML(view.nodes[0].shadowRoot.childNodes[0])).toEqual('Matched on id with other_id');
expect(view.nodes).toHaveText('Matched on id with other_id');
async.done();
});
@ -534,7 +534,6 @@ export function main() {
inline: '<dynamic-comp #dynamic></dynamic-comp>',
directives: [DynamicComp]
}));
compiler.compile(MyComp).then((pv) => {
createView(pv);