Sha256: 405c959c0a4494542ee479f918923b4861e8cab71011adeab155fd67dfd9f48e

Contents?: true

Size: 1009 Bytes

Versions: 41

Compression:

Stored size: 1009 Bytes

Contents

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

/*global module test equals context ok same */

var parent, child;
module("SC.View#replaceChild", {
	setup: function() {
	  child = SC.View.create();
	  parent = SC.View.create({
	    childViews: [SC.View, SC.View, SC.View]
	  });		
	}
});


test("swaps the old child with the new child", function() {
  var oldChild = parent.childViews[1];

  parent.replaceChild(child, oldChild);
  equals(child.get('parentView'), parent, 'child has new parent');
  ok(!oldChild.get('parentView'), 'old child no longer has parent');
  
  equals(parent.childViews[1], child, 'parent view has new child at loc 1');
  equals(parent.childViews.length, 3, 'parent has same number of children');
});

Version data entries

41 entries across 41 versions & 1 rubygems

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