// ========================================================================== // Project: SproutCore - JavaScript Application Framework // Copyright: ©2006-2009 Apple, Inc. and contributors. // License: Licened under MIT license (see license.js) // ========================================================================== /*global module test equals context ok same */ // .......................................................... // createChildViews() // module("SC.View#createChildViews"); test("calls createChildView() for each class or string in childViews array", function() { var called = []; var v = SC.View.create({ childViews: [ SC.View.extend({ key: 0 }), // class - should be called SC.View.create({ key: 1 }), // NOT class - should NOT be called 'customClassName' // string - should be called ], // this shuld be used for the 'customClassName' item above customClassName: SC.View.extend({ key: 2 }), // patch to record results... createChildView: function(childView) { called.push(childView.prototype.key); ok(childView.isClass, "childView: %@ isClass".fmt(childView)); return sc_super(); } }); // createChildViews() is called automatically during create. same(called, [0,2], 'called createChildView for correct children'); // make sure childViews array is correct now. var cv = v.childViews, len = cv.length, idx; for(idx=0;idx