Sha256: 48907ad70652191e187218e2a3e0aa6e144a059ad0bf41ee0eac29dc047f3b5b

Contents?: true

Size: 1.56 KB

Versions: 9

Compression:

Stored size: 1.56 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple, Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================

/*globals module test ok equals same CoreTest */

sc_require('debug/test_suites/array/base');

SC.ArraySuite.define(function(T) {
  
  var observer, obj ;
  
  module(T.desc("shiftObject"), {
    setup: function() {
      obj = T.newObject();
      observer = T.observer(obj);
    }
  });

  test("[].shiftObject() => [] + returns undefined + NO notify", function() {
    observer.observe('[]', 'length') ;
    equals(obj.shiftObject(), undefined, 'should return undefined') ;
    T.validateAfter(obj, [], observer, NO, NO);
  });

  test("[X].shiftObject() => [] + notify", function() {
    var exp = T.expected(1)[0];
    
    obj.replace(0,0, [exp]);
    observer.observe('[]', 'length') ;

    equals(obj.shiftObject(), exp, 'should return shifted object') ;
    T.validateAfter(obj, [], observer, YES, YES);
  });

  test("[A,B,C].shiftObject() => [B,C] + notify", function() {
    var before  = T.expected(3),
        value   = before[0],
        after   = before.slice(1);
        
    obj.replace(0,0,before);
    observer.observe('[]', 'length') ;
    equals(obj.shiftObject(), value, 'should return shifted object') ;
    T.validateAfter(obj, after, observer, YES);
  });
  
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js