Sha256: b24aeb29d2fa22552e5d3a9b7e1d048ce4db60029d257e3d0a2445bc9807c5aa

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

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

/*global module test equals context ok */

var context = null;

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

test("should return a new context with parent context as prevObject", function() {
  var c2 = context.begin();
  ok(c2 !== context, "new context");
  equals(c2.prevObject, context, 'previous context');
});

test("should set offset for new context equal to length of previous context", function() {
  context.push("line1");
  var expected = context.length ;
  var c2 = context.begin();
  equals(c2.offset, expected, "offset");
});

test("should copy same strings array to new child context", function() {
  context.push("line1");
  var c2 =context.begin();
  equals(c2.strings, context.strings);
});

test("should start new context with length of 1 (reserving a space for opening tag)", function() {
  context.push("line1");
  var c2 = context.begin() ;
  equals(c2.length, 1, 'has empty line');
  equals(c2.strings.length, 3, "parent empty line + parent line + empty line");
});

test("should assign passed tag name to new context", function() {
  var c2 = context.begin('foo');
  equals(c2.tagName(), 'foo', 'tag name');
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js