fix: don't call onAllChangesDone on checkNoChanges

This commit is contained in:
Misko Hevery 2015-05-18 21:29:23 -07:00 committed by Victor Berchet
parent 7643d979c7
commit a664f5a6de
2 changed files with 17 additions and 1 deletions

View File

@ -46,7 +46,7 @@ export class AbstractChangeDetector extends ChangeDetector {
this._detectChangesInLightDomChildren(throwOnChange); this._detectChangesInLightDomChildren(throwOnChange);
this.callOnAllChangesDone(); if (throwOnChange === false) this.callOnAllChangesDone();
this._detectChangesInShadowDomChildren(throwOnChange); this._detectChangesInShadowDomChildren(throwOnChange);

View File

@ -339,6 +339,22 @@ export function main() {
expect(directive1.onChangesDoneCalled).toBe(true); expect(directive1.onChangesDoneCalled).toBe(true);
expect(directive2.onChangesDoneCalled).toBe(true); expect(directive2.onChangesDoneCalled).toBe(true);
// reset directives
directive1.onChangesDoneCalled = false;
directive2.onChangesDoneCalled = false;
// Verify that checking should not call them.
cd.checkNoChanges();
expect(directive1.onChangesDoneCalled).toBe(false);
expect(directive2.onChangesDoneCalled).toBe(false);
// re-verify that changes are still detected
cd.detectChanges();
expect(directive1.onChangesDoneCalled).toBe(true);
expect(directive2.onChangesDoneCalled).toBe(true);
}); });