Sha256: 7fe5c7385d71cd9c1b798131d365481b5edb905a0910f2ab910798796098109a

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

// ========================================================================
// SC.makeArray Tests
// ========================================================================
/*globals module test */

var objectA,objectB,objectC; //global variables

module("Make Array ", {
  setup: function() {
    var objectA = [1,2,3,4,5] ;  
	var objectC = SC.hashFor(objectA);
	var objectD = null;
	var stringA = "string A" ;		
  }
});

test("should return an array for the object passed ",function(){
	var arrayA  = ['value1','value2'] ;
	var numberA = 100;
	var stringA = "SproutCore" ;
	var obj = {} ;
	var ret = SC.makeArray(obj);
	equals(SC.isArray(ret),true);	
	ret = SC.makeArray(stringA);
	equals(SC.isArray(ret), true) ;  	
	ret = SC.makeArray(numberA);
	equals(SC.isArray(ret),true) ;  	
	ret = SC.makeArray(arrayA);
	equals(SC.isArray(ret),true) ;
});

test("isArray should return true for empty arguments", function() {
  var func = function(foo, bar) {
    ok(SC.isArray(arguments), "arguments is an array");
  };
  func();
});

test("SC.$A should return an empty array if passed an empty arguments object", function() {
  var func = function(foo, bar) {
    equals(SC.$A(arguments).length, 0, "returns an empty array");
  };
  func();
});

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/runtime/tests/core/makeArray.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js