Sha256: d7f6087f51186cf55c81eab38516a6ca15c11106c6bf03ca33de4640f15d67b8

Contents?: true

Size: 1.78 KB

Versions: 30

Compression:

Stored size: 1.78 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
// Author: Richard Klancer <rpk@pobox.com>

/*globals module test ok equals same stop start */

module("Problematic SC.ObserverSet.getMethods() removal", {
  setup: function () {
    SC.LOG_OBSERVERS = YES;
  },
  teardown: function () {
    SC.LOG_OBSERVERS = NO;
  }
});

// This test succeeds using master up to commit 5826c745874f903f1e4765e5a2bcb5244ff72113 and using the 1-4-stable HEAD 
// This test fails using subsequent master commit c78e1bf25087a3ebd553dbc513923e0d32d09f7b
// It triggers an error at line 987 of frameworks/system/runtime/mixins/observable.js (in the method
// SC.Observable._notifyPropertyObservers()) as of current master commit, 789fe805cd08976b7aab1c346c71cf22b78b7285

test("Observers that remove themselves should fire at least once, and shouldn't cause an error", function () {
  expect(1);

  var observed = SC.Object.create({
    key: 'val'
  });

  var observer1, observer2;
  var observerFired = NO;

  function removeObservers() {
    observed.removeObserver('key', observer1);
    observed.removeObserver('key', observer2);
  }

  observer1 = function () {
    observerFired = YES;
    removeObservers();
  };
  observer2 = function () {
    observerFired = YES;
    removeObservers();
  };

  observed.addObserver('key', observer1);
  observed.addObserver('key', observer2);

  observed.set('key', 'newval');

  ok(observerFired, "At least one observer should have fired.");
});

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js