fix(change_detection): updated dynamic change detector not to mutate when throwing

Closes #1762
This commit is contained in:
vsavkin
2015-05-08 08:32:02 -07:00
committed by Misko Hevery
parent c68fa27444
commit d717529e9a
2 changed files with 46 additions and 18 deletions

View File

@ -420,6 +420,23 @@ export function main() {
cd.checkNoChanges();
}).toThrowError(new RegExp("Expression 'a in location' has changed after it was checked"));
});
it("should not break the next run", () => {
var pcd = createProtoChangeDetector([
BindingRecord.createForElement(ast("a"), 0, "a")
]);
var dispatcher = new TestDispatcher();
var cd = pcd.instantiate(dispatcher);
cd.hydrate(new TestData('value'), null, null);
expect(() => cd.checkNoChanges()).toThrowError(new RegExp(
"Expression 'a in location' has changed after it was checked."));
cd.detectChanges();
expect(dispatcher.loggedValues).toEqual(['value']);
});
});
//TODO vsavkin: implement it