Sha256: d47e1cd06519f67c1122a34890937b723b8206b094bd2299fdae3c4cd68a10b2

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

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 */

module("SC.View#destroy");

test('isDestroyed works.', function() {
  var v = SC.View.create();
  ok(!v.get('isDestroyed'), 'undestroyed view\'s isDestroyed property is false.');
  v.destroy();
  ok(v.get('isDestroyed'), 'destroyed view\'s isDestroyed property is true.');
});

test('childViews specified as classes are also destroyed.', function() {
  var v = SC.View.create({ childViews: [ SC.View ] }),
      v2 = v.childViews[0];
  v.destroy();
  ok(v2.get('isDestroyed'), 'destroying a parent also destroys a child, mwaha.');
  ok(!v2.get('parentView'), 'destroying a parent removes the parentView reference from the child.');
  ok(v2.get('owner') === null, 'destroying a parent removes the owner reference from the child.');
});

test('childViews specified as instances are also destroyed.', function() {
  var v2 = SC.View.create(),
      v = SC.View.create({ childViews: [v2] });
  v.destroy();
  ok(v2.get('isDestroyed'), 'destroying a parent also destroys a child, mwaha.');
  ok(!v2.get('parentView'), 'destroying a parent removes the parentView reference from the child.');
  ok(v2.get('owner') === null, 'destroying a parent removes the owner reference from the child.');
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js