Sha256: 5c127effb969f813d0c793590fc191fea43a154fd41d922907bb93e34c70184f

Contents?: true

Size: 1.55 KB

Versions: 17

Compression:

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

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

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

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

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

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js
sproutcore-1.0.1003 frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js