Sha256: 81c9a231dc39a6e79e4dc81a08b3958217ff24f1e7b9a213ac6a759fc1465218

Contents?: true

Size: 990 Bytes

Versions: 53

Compression:

Stored size: 990 Bytes

Contents

// ========================================================================
// SC.Timer Tests
// ========================================================================
/*globals module test ok isObj equals expects */

/**
  Exercises timer invalidation on the SC.Timer class.
*/
module("Timer.invalidate") ;

/**
  A timer scheduled and then invalidated before the end of the run loop should 
  not fire.
  
  @author Erich Ocean
  @since 6e7becdfb4e7f22b340eb5e6d7f3b4df4ea65060
*/
test("invalidate immediately should never execute", function() {
  
  var fired = NO ;
  
  SC.RunLoop.begin() ;
  var start = SC.RunLoop.currentRunLoop.get('startTime') ;
  var t = SC.Timer.schedule({
    target: this,
    action: function() { fired = YES ; },
    interval: 100
  });
  t.invalidate() ;
  SC.RunLoop.end() ;
  
  stop(2500) ; // stops the test runner, fails after 2500ms
  setTimeout(function() {
    equals(NO, fired) ;
    window.start() ; // starts the test runner
  }, 1500);
  
});

Version data entries

53 entries across 53 versions & 3 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
spade-0.0.1 sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/amber/tests/system/timer/invalidate.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js