Sha256: 33b41ba29b1953d20f11b5accd9d7cc679515a9138afab7b12b8a75529afdc5e
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 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() { isSet(context.get(), [null]); }); test("it should return full strings array if no params passed and no strings pushed yet", function() { context.push("line1"); isSet(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
2 entries across 2 versions & 1 rubygems