Sha256: 0d16388802ff88f61c08793cb4f79ccf30d6adebe585bc5bb88803e753019422

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed 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

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js