Sha256: 34733a157f341a0989587d7c93efd52f086d2ceb691f2baabb1b5d5618a602e8

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2011 Strobe 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("pushObject"), {
    setup: function() {
      obj = T.newObject();
      observer = T.observer(obj);
    }
  });

  test("returns pushed object", function() {
    var exp = T.expected(1)[0];
    equals(obj.pushObject(exp), exp, 'should return receiver');
  });
  
  test("[].pushObject(X) => [X] + notify", function() {
    var exp = T.expected(1);
    observer.observe('[]', 'length') ;
    obj.pushObject(exp[0]) ;
    T.validateAfter(obj, exp, observer, YES);
  });

  test("[A,B,C].pushObject(X) => [A,B,C,X] + notify", function() {
    var after  = T.expected(4),
        before = after.slice(0,3),
        value  = after[3];
        
    obj.replace(0,0,before);
    observer.observe('[]', 'length') ;
    obj.pushObject(value) ;
    T.validateAfter(obj, after, observer, YES);
  });
  
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js