mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed two propertyChange event notifications.
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
Reference in New Issue
Block a user