Sha256: 950c10865e3ea4c2fd124c420d03bdd8c8824dc7791bacea32ca9a870f43868d

Contents?: true

Size: 1.75 KB

Versions: 41

Compression:

Stored size: 1.75 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

// ========================================================================
// SC.Builder Base Tests
// ========================================================================
/*globals module test ok isObj equals expects */

var obj; //global variables

// Test cases for pushStack and end functions
module("Builder",{
	 
	  setup: function(){
	  	obj = [1,2,3,4];
	    
	}
});

test("To check if the set of array elements are pushed into stack",function(){
    
    var c = SC.Builder.fn.pushStack(obj);
    equals(4,obj.length = c.length,'No Of elements in the stack');
    equals(YES,obj[0]==c[0],'First element');
    equals(YES,obj[1]==c[1],'Second element'); 
    equals(YES,obj[2]==c[2],'Third element'); 
    equals(YES,obj[3]==c[3],'Fourth element'); 

    var d = SC.Builder.fn.end();
    equals(YES,SC.typeOf(d) == SC.T_HASH,'Previous item returned');   
});

test("create a new builder subclass with any passed properties copied to the builder's 'fn' property",function(){
	obj =SC.Builder.create({ name : 'Charles'});
	var fn_name =obj.fn.name;
	equals(fn_name,"Charles","name should match");
});

test("instantiate the builder, any passed args will be forwarded onto an internal init() method",function(){
	obj = new SC.Builder({name : 'Charles',age :23, sex :'M'});
	var objA =obj.fn.init();
	equals(objA.name,obj.fn.name);
	equals(objA.age,obj.fn.age);
	equals(objA.sex,obj.fn.sex);
});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/builder.js