Sha256: be42c0378b0f938a5c3985fc3d9c7a700bde6d5399c0892b587b6338c5a0b126
Contents?: true
Size: 1.58 KB
Versions: 13
Compression:
Stored size: 1.58 KB
Contents
// ======================================================================== // SC.Timer Base Tests // ======================================================================== /*globals module test ok isObj equals expects */ module("SC.Timer.fireTime + SC.Timer.performAction ",{ setup: function() { objectA = {} ; objectB = {} ; object = SC.Object.create({ performActionProp:'', callAction:function(){ this.set('performActionProp','performAction'); } }); } }); test("performAction() should call the specified method ",function(){ var timerObj; timerObj = SC.Timer.create(); //created a timer object timerObj.action = object.callAction(); timerObj.performAction(); equals('performAction',object.performActionProp); }); test("fireTime() should return the next time the timer should fire", function(){ var timerObj; timerObj = SC.Timer.create(); equals(-1,timerObj.fireTime(),'for isValid YES'); equals(-1,timerObj.fireTime(),'for startTime not set'); timerObj.startTime = 10; timerObj.interval = 10; timerObj.lastFireTime = 5; equals(20,timerObj.fireTime(),'next fire time'); }); test("fire() should call the action", function() { var count = 0; SC.RunLoop.begin() ; var start = SC.RunLoop.currentRunLoop.get('startTime') ; var t = SC.Timer.schedule({ target: this, action: function() { count++; }, interval: 100 }); t.fire(); SC.RunLoop.end() ; stop(2500) ; // stops the test runner, fails after 2500ms setTimeout(function() { equals(2, count) ; window.start() ; // starts the test runner }, 1500); });
Version data entries
13 entries across 13 versions & 2 rubygems