1 // ========================================================================== 2 // Project: SproutCore Costello - Property Observing Library 3 // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors. 4 // Portions ©2008-2010 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /*globals module test ok equals same CoreTest */ 9 10 sc_require('debug/test_suites/array/base'); 11 12 SC.ArraySuite.define(function(T) { 13 14 T.module("flatten"); 15 16 test("should return flattened arrays", function() { 17 var expected = [1,2,3,4,'a'], 18 obj = T.newObject([1,2,[3,[4]],'a']); 19 20 expected.forEach(function(i,idx) { 21 equals(obj.flatten().objectAt(idx), i,'obj.flatten().objectAt(%@) should match %@'.fmt(idx,i)); 22 }); 23 }); 24 }); 25