Sha256: fef1bfd1dc40a5840582036bb212cfd7eb89285cc2fd4ae7f3f76758d5fe6107
Contents?: true
Size: 1.72 KB
Versions: 17
Compression:
Stored size: 1.72 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 */ var context = null; module("SC.RenderContext#get", { setup: function() { context = SC.RenderContext(); }, teardown: function() { context = null; } }); test("it should return strings array with space for top tag if no params passed and no strings pushed yet", function() { same(context.get(), [null]); }); test("it should return full strings array if no params passed and no strings pushed yet", function() { context.push("line1"); same(context.get(), [null, "line1"]); }); test("it should return individual string if index passed that is within current length", function() { context.push("line1"); equals(context.get(1), "line1"); }); test("it should return undefined if index passed that is outside of current range", function() { context.push("line1"); equals(context.get(3), undefined); }); // test this special case since the internal strings array is created lazily. test("it should return undefined if index passed and no strings set yet", function() { equals(context.get(2), undefined); }); test("it should return the value based on an index from the context offset of the context is chained", function() { context.push('line1', 'line2'); var childContext = context.begin(); childContext.push("NEXT"); equals(childContext.get(1), "NEXT", 'gets child line'); }) ;
Version data entries
17 entries across 17 versions & 2 rubygems