Sha256: 6a842ca7a960fe9cd35ff3eaf0fd240013efcd8ec757f7d0fb89f23f8c6176ad
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
// ========================================================================== // Project: SproutCore Costello - Property Observing Library // Copyright: ©2006-2011 Strobe Inc. and contributors. // Portions ©2008-2011 Apple Inc. All rights reserved. // License: Licensed under MIT license (see license.js) // ========================================================================== // Unit test some standard SC.Array implementations. // .......................................................... // BUILT-IN ARRAY // sc_require('debug/test_suites/array'); SC.ArraySuite.generate("built-in Array"); // .......................................................... // DUMMY ARRAY (BASIC FAKE IMPLEMENTATION) // // Test the SproutCore Array interface on a custom object. var DummyArray = SC.Object.extend(SC.Array, { length: 0, content: null, replace: function(idx, amt, objects) { if (!this.content) this.content = [] ; this.beginPropertyChanges() ; this.content.replace(idx,amt,objects) ; this.set('length', this.content.length) ; // figure out the range that changed. If amt + objects are the same, use // amt. Otherwise use total length. var len = objects ? objects.get('length') : 0; this.enumerableContentDidChange(idx, amt, len - amt) ; this.endPropertyChanges() ; }, objectAt: function(idx) { if (!this.content) this.content = [] ; return this.content[idx] ; } }); SC.ArraySuite.generate("DummyArray", { newObject: function(expected) { if (!expected || typeof expected === SC.T_NUMBER) { expected = this.expected(expected); } return DummyArray.create({ content: expected, length: expected.length }) ; } });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sproutcore-1.5.0.rc.1 | lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js |