Sha256: 969d29b2f6961571e2102575345bd86806dfeb694c01a82fd5bf806922e9a1d9

Contents?: true

Size: 1.9 KB

Versions: 41

Compression:

Stored size: 1.9 KB

Contents

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

/*global module test equals context */

var context = null;

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

test("should emit a self closing tag.  like calling begin().end()", function() {
  context.tag("input");
  equals(SC.RenderContext.escapeHTML(context.get(1)), SC.RenderContext.escapeHTML("<input />"));
});

test("should respect passed opts when emitting", function() {
  context.tag("foo") ;
  equals(context.length, 3);
  equals(SC.RenderContext.escapeHTML(context.get(1)), SC.RenderContext.escapeHTML("<foo>"));
  equals(SC.RenderContext.escapeHTML(context.get(2)), SC.RenderContext.escapeHTML('<'+'/foo>'));
});

test("should NOT emit self closing tag if tag is script", function() {
  context.tag("script");
  equals(SC.RenderContext.escapeHTML(context.get(1)), SC.RenderContext.escapeHTML('<script>'));
  equals(SC.RenderContext.escapeHTML(context.get(2)), SC.RenderContext.escapeHTML('<'+'/script>'));
});

test("should NOT emit self closing tag if tag is div", function() {
  context.tag("div");
  equals(SC.RenderContext.escapeHTML(context.get(1)), SC.RenderContext.escapeHTML('<div>'));
  equals(SC.RenderContext.escapeHTML(context.get(2)), SC.RenderContext.escapeHTML('<'+'/div>'));
});

test("should NOT emit self closing tag if no tag is passed", function() {
  context.tag();
  equals(SC.RenderContext.escapeHTML(context.get(1)), SC.RenderContext.escapeHTML('<div>'));
  equals(SC.RenderContext.escapeHTML(context.get(2)), SC.RenderContext.escapeHTML('<'+'/div>'));
});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js