Sha256: 7d6bbf23424c735aed2ad946867813e1114035637080827cb0b22571214bd87a

Contents?: true

Size: 1.9 KB

Versions: 13

Compression:

Stored size: 1.9 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#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

13 entries across 13 versions & 1 rubygems

Version Path
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js