Sha256: a7add386183b3aafda7a97a51b0f5ec5b5c681b621ae2ec18bf8271ca9a11e7d

Contents?: true

Size: 1.37 KB

Versions: 11

Compression:

Stored size: 1.37 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple, Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok */

var context = null;

module("SC.RenderContext#element", {
  setup: function() {
    context = SC.RenderContext() ;
  },
  
  teardown: function() {
    context = null;
  }
});

test("converts context to a DOM element and returns root element if there is one", function() {
  context.id('foo');
  var elem = context.element();
  ok(elem, 'elem not null');
  equals(elem.tagName.toString().toLowerCase(), 'div', 'is div');
  equals(elem.id.toString(), 'foo', 'is id=foo');
  elem = null ;
});

test("returns null if context does not generate valid element", function() {
  context = SC.RenderContext(null);
  var elem = context.element();
  equals(elem, null, 'should be null');
  elem = null;
});

test("returns first element if context renders multiple element", function() {
  context.tag('div').tag('span');
  var elem = context.element();
  ok(elem, 'elem not null');
  equals(elem.tagName.toString().toLowerCase(), 'div', 'is div');
  elem = null;
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js