Sha256: 44ee3ad8908698a746fda8dfb2ea7803262b9cbc043fbee4d9b9a7f2f753c506
Contents?: true
Size: 1.73 KB
Versions: 11
Compression:
Stored size: 1.73 KB
Contents
// ========================================================================== // Project: SproutCore Costello - Property Observing Library // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors. // Portions ©2008-2010 Apple Inc. All rights reserved. // License: Licensed under MIT license (see license.js) // ========================================================================== var callCount, obj; module("SC.Observers.isObservingSuspended", { setup: function() { callCount = 0; obj = SC.Object.create({ foo: "bar", fooDidChange: function() { callCount++; }.observes('foo') }); } }); test("suspending observers stops notification", function() { SC.Observers.suspendPropertyObserving(); SC.Observers.suspendPropertyObserving(); obj.set("foo"); equals(callCount, 0, 'should not notify observer while suspended'); SC.Observers.resumePropertyObserving(); equals(callCount, 0, 'should not notify observer while still suspended'); SC.Observers.resumePropertyObserving(); equals(callCount, 1, 'should notify observer when resumed'); }); // .......................................................... // SPECIAL CASES // // this test verifies a specific bug in the SC.Observing.propertyDidChange method. test("suspended notifications should work when nesting property change groups", function() { SC.Observers.suspendPropertyObserving(); obj.beginPropertyChanges(); obj.set("foo"); equals(callCount, 0, 'should not notify observer while suspended'); obj.endPropertyChanges(); equals(callCount, 0, 'should not notify observer while suspended'); SC.Observers.resumePropertyObserving(); equals(callCount, 1, 'should notify observer when resumed'); });
Version data entries
11 entries across 11 versions & 1 rubygems