feat(query): notify on changes

This commit is contained in:
vsavkin
2015-06-12 09:45:31 -07:00
parent 73d152506b
commit 5bfcca2d5b
11 changed files with 129 additions and 7 deletions

View File

@ -324,6 +324,12 @@ export function main() {
});
});
it('should notify the dispatcher on all changes done', () => {
var val = _createChangeDetector('name', new Person('bob'));
val.changeDetector.detectChanges();
expect(val.dispatcher.onAllChangesDoneCalled).toEqual(true);
});
describe('updating directives', () => {
var directive1;
var directive2;
@ -975,6 +981,7 @@ class FakeDirectives {
class TestDispatcher extends ChangeDispatcher {
log: List<string>;
loggedValues: List<any>;
onAllChangesDoneCalled: boolean = false;
constructor() {
super();
@ -984,6 +991,7 @@ class TestDispatcher extends ChangeDispatcher {
clear() {
this.log = ListWrapper.create();
this.loggedValues = ListWrapper.create();
this.onAllChangesDoneCalled = true;
}
notifyOnBinding(binding, value) {
@ -991,6 +999,8 @@ class TestDispatcher extends ChangeDispatcher {
ListWrapper.push(this.loggedValues, value);
}
notifyOnAllChangesDone() { this.onAllChangesDoneCalled = true; }
_asString(value) { return (isBlank(value) ? 'null' : value.toString()); }
}