Fixed two propertyChange event notifications.

This commit is contained in:
Nedyalko Nikolov
2015-10-21 13:19:19 +03:00
parent 497dc235bc
commit 355db039c9
2 changed files with 22 additions and 2 deletions

View File

@@ -478,4 +478,16 @@ export var test_ObservablesCreatedWithJSON_shouldNotInterfereWithOneAnother = fu
TKUnit.wait(0.1);
TKUnit.assert(propName2 === "property2", "propName2 should be 'property2'");
TKUnit.assert(newValue2 === 20, "newValue2 should be 20");
};
};
export function test_ObservablesCreatedWithJSON_shouldNotEmitTwoTimesPropertyChangeEvent() {
var testObservable = new observable.Observable({ "property1": 1 });
var propertyChangeCounter = 0;
var propertyChangeHandler = function (args) {
propertyChangeCounter++;
}
testObservable.on(observable.Observable.propertyChangeEvent, propertyChangeHandler);
testObservable.set("property1", 2);
TKUnit.assertEqual(propertyChangeCounter, 1, "PropertyChange event should be fired only once for a single change.");
}