refactor(change_detection): renamed BindingPropagationConfig to ChangeDetectorRef

This commit is contained in:
vsavkin
2015-04-14 07:47:12 -07:00
parent 213dabdceb
commit 8c1adabe1c
17 changed files with 89 additions and 73 deletions
@@ -673,7 +673,7 @@ export function main() {
cd.detectChanges();
expect(registry.bpc).toBe(cd.bindingPropagationConfig);
expect(registry.cdRef).toBe(cd.changeDetectorRef);
});
});
@@ -762,7 +762,7 @@ class FakePipeRegistry extends PipeRegistry {
numberOfLookups:number;
pipeType:string;
factory:Function;
bpc:any;
cdRef:any;
constructor(pipeType, factory) {
super({});
@@ -771,10 +771,10 @@ class FakePipeRegistry extends PipeRegistry {
this.numberOfLookups = 0;
}
get(type:string, obj, bpc) {
get(type:string, obj, cdRef) {
if (type != this.pipeType) return null;
this.numberOfLookups ++;
this.bpc = bpc;
this.cdRef = cdRef;
return this.factory();
}
}
@@ -51,7 +51,7 @@ class PipeFactory {
return this.shouldSupport;
}
create(bpc):Pipe {
create(cdRef):Pipe {
return this.pipe;
}
}
@@ -11,7 +11,7 @@ import {AppProtoView, AppView} from 'angular2/src/core/compiler/view';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Directive} from 'angular2/src/core/annotations/annotations';
import {BindingPropagationConfig, Parser, Lexer} from 'angular2/change_detection';
import {ChangeDetectorRef, Parser, Lexer} from 'angular2/change_detection';
import {ViewRef, Renderer, EventBinding} from 'angular2/src/render/api';
import {QueryList} from 'angular2/src/core/compiler/query_list';
@@ -620,11 +620,11 @@ export function main() {
expect(inj.get(ViewContainer)).toEqual(viewContainer);
});
it('should return bindingPropagationConfig', function () {
var config = new BindingPropagationConfig(null);
it('should return changeDetectorRef', function () {
var config = new ChangeDetectorRef(null);
var inj = injector([], null, null, new PreBuiltObjects(null, null, null, config));
expect(inj.get(BindingPropagationConfig)).toEqual(config);
expect(inj.get(ChangeDetectorRef)).toEqual(config);
});
});
+7 -7
View File
@@ -22,7 +22,7 @@ import {PromiseWrapper} from 'angular2/src/facade/async';
import {Injector, bind} from 'angular2/di';
import {dynamicChangeDetection,
ChangeDetection, DynamicChangeDetection, Pipe, PipeRegistry, BindingPropagationConfig, ON_PUSH} from 'angular2/change_detection';
ChangeDetection, DynamicChangeDetection, Pipe, PipeRegistry, ChangeDetectorRef, ON_PUSH} from 'angular2/change_detection';
import {Decorator, Component, Viewport, DynamicComponent} from 'angular2/src/core/annotations/annotations';
import {View} from 'angular2/src/core/annotations/view';
@@ -390,7 +390,7 @@ export function main() {
})
}));
describe("BindingPropagationConfig", () => {
describe("ChangeDetectorRef", () => {
it("can be used to disable the change detection of the component's template",
inject([TestBed, AsyncTestCompleter], (tb, async) => {
@@ -802,12 +802,12 @@ class MyDir {
@View({template: '{{field}}'})
class PushBasedComp {
numberOfChecks:number;
bpc:BindingPropagationConfig;
ref:ChangeDetectorRef;
prop;
constructor(bpc:BindingPropagationConfig) {
constructor(ref:ChangeDetectorRef) {
this.numberOfChecks = 0;
this.bpc = bpc;
this.ref = ref;
}
get field(){
@@ -816,7 +816,7 @@ class PushBasedComp {
}
propagate() {
this.bpc.shouldBePropagatedFromRoot();
this.ref.requestCheck();
}
}
@@ -943,7 +943,7 @@ class DoublePipeFactory {
return true;
}
create(bpc) {
create(cdRef) {
return new DoublePipe();
}
}