removed circular deps so tests run on node
This commit is contained in:
parent
b92d16c08e
commit
99f2d7faf6
@ -1,11 +1,11 @@
|
|||||||
import {int, isBlank, BaseException} from 'angular2/src/facade/lang';
|
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 {DirectiveMetadata} from './directive_metadata';
|
||||||
import {List, StringMap} from 'angular2/src/facade/collection';
|
import {List, StringMap} from 'angular2/src/facade/collection';
|
||||||
import {ProtoView} from './view';
|
import {ProtoView} from './view';
|
||||||
|
|
||||||
export class ElementBinder {
|
export class ElementBinder {
|
||||||
protoElementInjector:ProtoElementInjector;
|
protoElementInjector:eiModule.ProtoElementInjector;
|
||||||
componentDirective:DirectiveMetadata;
|
componentDirective:DirectiveMetadata;
|
||||||
viewportDirective:DirectiveMetadata;
|
viewportDirective:DirectiveMetadata;
|
||||||
textNodeIndices:List<int>;
|
textNodeIndices:List<int>;
|
||||||
@ -18,7 +18,7 @@ export class ElementBinder {
|
|||||||
distanceToParent:int;
|
distanceToParent:int;
|
||||||
constructor(
|
constructor(
|
||||||
index:int, parent:ElementBinder, distanceToParent: int,
|
index:int, parent:ElementBinder, distanceToParent: int,
|
||||||
protoElementInjector: ProtoElementInjector, componentDirective:DirectiveMetadata,
|
protoElementInjector: eiModule.ProtoElementInjector, componentDirective:DirectiveMetadata,
|
||||||
viewportDirective:DirectiveMetadata) {
|
viewportDirective:DirectiveMetadata) {
|
||||||
if (isBlank(index)) {
|
if (isBlank(index)) {
|
||||||
throw new BaseException('null index not allowed.');
|
throw new BaseException('null index not allowed.');
|
||||||
|
@ -9,7 +9,7 @@ import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
|||||||
import {NgElement} from 'angular2/src/core/dom/element';
|
import {NgElement} from 'angular2/src/core/dom/element';
|
||||||
import {Directive, onChange, onDestroy} from 'angular2/src/core/annotations/annotations';
|
import {Directive, onChange, onDestroy} from 'angular2/src/core/annotations/annotations';
|
||||||
import {BindingPropagationConfig} from 'angular2/src/core/compiler/binding_propagation_config';
|
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';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
|
||||||
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
|
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
|
||||||
@ -33,7 +33,7 @@ class StaticKeys {
|
|||||||
this.ngElementId = Key.get(NgElement).id;
|
this.ngElementId = Key.get(NgElement).id;
|
||||||
this.viewContainerId = Key.get(ViewContainer).id;
|
this.viewContainerId = Key.get(ViewContainer).id;
|
||||||
this.bindingPropagationConfigId = Key.get(BindingPropagationConfig).id;
|
this.bindingPropagationConfigId = Key.get(BindingPropagationConfig).id;
|
||||||
this.privateComponentLocationId = Key.get(PrivateComponentLocation).id;
|
this.privateComponentLocationId = Key.get(pclModule.PrivateComponentLocation).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static instance() {
|
static instance() {
|
||||||
@ -603,7 +603,7 @@ export class ElementInjector extends TreeNode {
|
|||||||
if (keyId === staticKeys.bindingPropagationConfigId) return this._preBuiltObjects.bindingPropagationConfig;
|
if (keyId === staticKeys.bindingPropagationConfigId) return this._preBuiltObjects.bindingPropagationConfig;
|
||||||
|
|
||||||
if (keyId === staticKeys.privateComponentLocationId) {
|
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
|
//TODO add other objects as needed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Directive} from 'angular2/src/core/annotations/annotations'
|
import {Directive} from 'angular2/src/core/annotations/annotations'
|
||||||
import {NgElement} from 'angular2/src/core/dom/element';
|
import {NgElement} from 'angular2/src/core/dom/element';
|
||||||
import {ElementInjector} from './element_injector';
|
import * as viewModule from './view';
|
||||||
import {ProtoView, View} from './view';
|
import * as eiModule from './element_injector';
|
||||||
import {ShadowDomStrategy} from './shadow_dom_strategy';
|
import {ShadowDomStrategy} from './shadow_dom_strategy';
|
||||||
import {EventManager} from 'angular2/src/core/events/event_manager';
|
import {EventManager} from 'angular2/src/core/events/event_manager';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
@ -9,17 +9,17 @@ import {Type} from 'angular2/src/facade/lang';
|
|||||||
|
|
||||||
|
|
||||||
export class PrivateComponentLocation {
|
export class PrivateComponentLocation {
|
||||||
_elementInjector:ElementInjector;
|
_elementInjector:eiModule.ElementInjector;
|
||||||
_elt:NgElement;
|
_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._elementInjector = elementInjector;
|
||||||
this._elt = elt;
|
this._elt = elt;
|
||||||
this._view = view;
|
this._view = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
createComponent(type:Type, annotation:Directive, componentProtoView:ProtoView,
|
createComponent(type:Type, annotation:Directive, componentProtoView:viewModule.ProtoView,
|
||||||
eventManager:EventManager, shadowDomStrategy:ShadowDomStrategy) {
|
eventManager:EventManager, shadowDomStrategy:ShadowDomStrategy) {
|
||||||
var context = this._elementInjector.createPrivateComponent(type, annotation);
|
var context = this._elementInjector.createPrivateComponent(type, annotation);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import {Lexer, Parser, dynamicChangeDetection,
|
|||||||
|
|
||||||
import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
|
import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
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 {PrivateComponentLocation} from 'angular2/src/core/compiler/private_component_location';
|
||||||
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
|
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
|
||||||
import {TemplateLoader} from 'angular2/src/core/compiler/template_loader';
|
import {TemplateLoader} from 'angular2/src/core/compiler/template_loader';
|
||||||
@ -67,7 +67,7 @@ export function main() {
|
|||||||
directiveMetadataReader = new DirectiveMetadataReader();
|
directiveMetadataReader = new DirectiveMetadataReader();
|
||||||
|
|
||||||
var urlResolver = new UrlResolver();
|
var urlResolver = new UrlResolver();
|
||||||
shadowDomStrategy = new NativeShadowDomStrategy(new StyleUrlResolver(urlResolver));
|
shadowDomStrategy = new EmulatedUnscopedShadowDomStrategy(new StyleUrlResolver(urlResolver), null);
|
||||||
|
|
||||||
compiler = createCompiler(tplResolver, dynamicChangeDetection);
|
compiler = createCompiler(tplResolver, dynamicChangeDetection);
|
||||||
});
|
});
|
||||||
@ -247,7 +247,7 @@ export function main() {
|
|||||||
|
|
||||||
cd.detectChanges();
|
cd.detectChanges();
|
||||||
|
|
||||||
expect(view.nodes[0].shadowRoot.childNodes[0].nodeValue).toEqual('hello');
|
expect(view.nodes).toHaveText('hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
@ -301,12 +301,12 @@ export function main() {
|
|||||||
ctx.ctxProp = 'some_id';
|
ctx.ctxProp = 'some_id';
|
||||||
cd.detectChanges();
|
cd.detectChanges();
|
||||||
expect(view.nodes[0].id).toEqual('some_id');
|
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';
|
ctx.ctxProp = 'other_id';
|
||||||
cd.detectChanges();
|
cd.detectChanges();
|
||||||
expect(view.nodes[0].id).toEqual('other_id');
|
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();
|
async.done();
|
||||||
});
|
});
|
||||||
@ -534,7 +534,6 @@ export function main() {
|
|||||||
inline: '<dynamic-comp #dynamic></dynamic-comp>',
|
inline: '<dynamic-comp #dynamic></dynamic-comp>',
|
||||||
directives: [DynamicComp]
|
directives: [DynamicComp]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
compiler.compile(MyComp).then((pv) => {
|
compiler.compile(MyComp).then((pv) => {
|
||||||
createView(pv);
|
createView(pv);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user