Sha256: 4cd4628a4528f365c393905dae62efac740007a87b9d2cb4980d5400f26b967d

Contents?: true

Size: 1.35 KB

Versions: 41

Compression:

Stored size: 1.35 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
// ========================================================================
// 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

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js