Sha256: baff620f26947de3b8f624ef011ff666c1d50fd00f3de3646754286b2d56033a

Contents?: true

Size: 1.56 KB

Versions: 7

Compression:

Stored size: 1.56 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 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

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js