Sha256: 5b7866f1d31b254f90b037de6cfcaf04d455f01638a63f78b0593a9acba93ced

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

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

  test("should return receiver", function() {
    obj = T.newObject(3);
    equals(obj.removeObject(obj.objectAt(0)), obj, 'should return receiver');
  });
  
  test("[A,B,C].removeObject(B) => [A,C] + notify", function() {

    var before = T.expected(3),
        after  = [before[0], before[2]];
    obj.replace(0,0, before);
    observer.observe('[]', 'length') ;
    
    obj.removeObject(before[1]) ;
    T.validateAfter(obj, after, observer, YES);
  });
  
  test("[A,B,C].removeObject(D) => [A,B,C]", function() {
    var exp = T.expected(4),
        extra = exp.pop();
    obj.replace(0,0,exp);
    observer.observe('[]', 'length') ;
    
    obj.removeObject(extra);
    T.validateAfter(obj, exp, observer, NO, NO);
  });
  
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js