Sha256: 398be81d4d5492da48670679cab8b367f4aa712cb938b7c3b5d8c4b936e0f36c

Contents?: true

Size: 1.37 KB

Versions: 11

Compression:

Stored size: 1.37 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("unshiftObject"), {
    setup: function() {
      obj = T.newObject();
      observer = T.observer(obj);
    }
  });

  test("returns unshifted object", function() {
    var exp = T.expected(1)[0];
    equals(obj.pushObject(exp), exp, 'should return receiver');
  });
  

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

  test("[A,B,C].unshiftObject(X) => [X,A,B,C] + notify", function() {
    var after  = T.expected(4),
        before = after.slice(1),
        value  = after[0];
        
    obj.replace(0,0,before);
    observer.observe('[]', 'length') ;
    obj.unshiftObject(value) ;
    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/unshiftObject.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js