You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ev...@apache.org on 2008/10/20 20:58:53 UTC

svn commit: r706366 - /incubator/shindig/trunk/features/opensocial-templates/template_test.js

Author: evan
Date: Mon Oct 20 11:58:53 2008
New Revision: 706366

URL: http://svn.apache.org/viewvc?rev=706366&view=rev
Log:
SHINDIG-649 : tests for whitespace handling in IE for templates

Modified:
    incubator/shindig/trunk/features/opensocial-templates/template_test.js

Modified: incubator/shindig/trunk/features/opensocial-templates/template_test.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/template_test.js?rev=706366&r1=706365&r2=706366&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/template_test.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/template_test.js Mon Oct 20 11:58:53 2008
@@ -283,19 +283,19 @@
 function testConditional_Number() {
   var outputNode = compileAndRender_("_T_Conditional_Number");
 
-  assertEquals("TRUE", domutil.getVisibleText(outputNode));
+  assertEquals("TRUE", domutil.getVisibleTextTrim(outputNode));
 }
 
 function testConditional_String() {
   var outputNode = compileAndRender_("_T_Conditional_String");
 
-  assertEquals("TRUE", domutil.getVisibleText(outputNode));
+  assertEquals("TRUE", domutil.getVisibleTextTrim(outputNode));
 }
 
 function testConditional_Mixed() {
   var outputNode = compileAndRender_("_T_Conditional_Mixed");
 
-  assertEquals("TRUE", domutil.getVisibleText(outputNode));
+  assertEquals("TRUE", domutil.getVisibleTextTrim(outputNode));
 }
 
 /**
@@ -735,3 +735,32 @@
   template.renderInto(output);
   assertEquals('bar', output.firstChild.title);
 };
+
+function testSpacesAmongTags() {
+  var tryTemplateContent = function(templateText) {
+    var template = os.compileTemplateString(templateText);
+    var output = template.render();
+    assertEquals('Hello world!', domutil.getVisibleTextTrim(output));
+  }
+
+  os.Loader.loadContent('<Templates xmlns:os="uri:unused">' +
+    '<Template tag="os:msg">${My.text}</Template></Templates>');
+
+  tryTemplateContent('<div><os:msg text="Hello"/>\n' +
+      ' <os:msg text="world!"/></div>');
+  tryTemplateContent('<div><os:msg text="Hello"/>  ' +
+      '<os:msg text="world!"/></div>');
+  tryTemplateContent('<div> <os:msg text="Hello"/>  ' +
+      '<os:msg text="world!"/>\n</div>');
+
+  os.Loader.loadContent('<Templates xmlns:os="uri:unused">' +
+    '<Template tag="os:msg"><os:Render/></Template></Templates>');
+
+  tryTemplateContent('<div><os:msg>Hello</os:msg>\n' +
+      ' <os:msg>world!</os:msg>\n</div>');
+  tryTemplateContent('<div><os:msg>Hello</os:msg>' +
+      '  <os:msg>world!</os:msg></div>');
+  tryTemplateContent('<div>\n  <os:msg>Hello</os:msg>' +
+      '  <os:msg>world!</os:msg>\n</div>');
+};
+