Sha256: bb4d5b3d01a4443fdd5793c4c1de4c014cf3e94b178b95adb26be7f8b64310bd

Contents?: true

Size: 1.32 KB

Versions: 25

Compression:

Stored size: 1.32 KB

Contents

// ========================================================================
// SC.UserDefaults Base Tests
// ========================================================================
/*globals module test ok isObj equals expects */
var taskQueue;
module("User Defaults",{
  setup: function(){
    taskQueue = SC.TaskQueue.create();
  }
});



test("Adding a task should not cause it to run.",function(){
  var task = SC.Task.create({ run: function(){ this.ran = YES; } });
  taskQueue.push(task);
  
  ok(!task.ran, "Task should not have run");
});


test("Adding a task and calling run() should cause the task to be run.",function(){
  var task = SC.Task.create({ run: function(){ this.ran = YES; } });
  taskQueue.push(task);
  taskQueue.run();
  
  ok(task.ran, "Task should have run");
});

test("Adding multiple tasks and calling run should run the tasks in order.",function(){
  var ri = 0;
  var task = SC.Task.extend({ run: function(){ this.ran = ri++; } }), t1, t2, t3, t4;
  taskQueue.push(t1 = task.create());
  taskQueue.push(t2 = task.create());
  taskQueue.push(t3 = task.create());
  taskQueue.push(t4 = task.create());
  taskQueue.run();
  
  equals(t1.ran, 0, "Task 1 should be first");
  equals(t2.ran, 1, "Task 1 should be second");
  equals(t3.ran, 2, "Task 1 should be third");
  equals(t4.ran, 3, "Task 1 should be fourth");
});

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js