Author: jmorliaguet
Date: Fri Feb 10 21:15:15 2006
New Revision: 2338

Added:
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html
   (contents, props changed)
Log:

- began writing tests for CTAL



Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html
  Fri Feb 10 21:15:15 2006
@@ -0,0 +1,140 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xml:lang="en" lang="en"
+      xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:cpsskins=http://namespaces.zope.org/cpsskins";>
+<head>
+  <title>CPSSkins Unit test file</title>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <script src="../../prototype.js" type="text/javascript"></script>
+  <script src="../../ctal.js" type="text/javascript"></script>
+  <script src="../unittest.js" type="text/javascript"></script>
+  <link rel="stylesheet" href="../test.css" type="text/css" />
+</head>
+<body>
+
+<h1>CPSSkins - CTAL unit tests</h1>
+
+<p>
+  Tests for the CTAL interpreter.
+</p>
+
+<!-- Log output -->
+<div id="testlog"> </div>
+
+<!-- Testing area -->
+
+<!-- ctal:content -->
+<div id="e0"><span ctal:content="a">...</span></div>
+<div id="e1"><span ctal:content="c/d">...</span></div>
+<div id="e2"><span ctal:content="string:A">...</span></div>
+<div id="e3"><span ctal:content="k/l/m">...</span></div>
+
+<!-- ctal:condition / ctal:content -->
+<div id="e4"><span ctal:condition="ctrue"
+                   ctal:content="string:B">...</span></div>
+
+<div id="e5"><span ctal:condition="cfalse"
+                   ctal:content="string:C">...</span></div>
+
+<!-- ctal:content / ctal:attributes -->
+<div id="e6"><span ctal:content="string:D"
+                   ctal:attributes="style string:E">...</span></div>
+
+<!-- ctal:condition / ctal:content / ctal:attributes -->
+<div id="e7"><span ctal:condition="ctrue"
+                   ctal:content="string:F"
+                   ctal:attributes="style string:G">...</span></div>
+
+<div id="e8"><span ctal:condition="cfalse"
+                   ctal:content="string:H"
+                   ctal:attributes="style string:I">...</span></div>
+
+<!-- ctal:omit-tag / ctal:content -->
+<div id="e9"><span ctal:omit-tag="ctrue"
+                   ctal:condition="ctrue"
+                   ctal:content="string:J">...</span></div>
+
+<div id="e10"><span ctal:omit-tag="ctrue"
+                    ctal:condition="cfalse"
+                    ctal:content="string:K">...</span></div>
+
+<div id="e11"><span ctal:omit-tag="cfalse"
+                    ctal:condition="ctrue"
+                    ctal:content="string:L">...</span></div>
+
+<div id="e12"><span ctal:omit-tag="cfalse"
+                    ctal:condition="cfalse"
+                    ctal:content="string:M">...</span></div>
+
+
+<!-- Tests follow -->
+<script type="text/javascript">
+// <![CDATA[
+
+  var e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14;
+
+  var data = {
+    a: 1,
+    b: 2,
+    c: {
+      d: 3,
+      e: 4
+    },
+    f: [4, 5, 6],
+    g: [
+      {h: 7, i: 8, j: 9}
+    ],
+    k: {
+      l: {
+        m: 10
+      }
+    },
+
+    ctrue: 1,
+    cfalse: 0
+  }
+
+  new Test.Unit.Runner({
+
+    setup: function() {
+      ctal.process_ctal(document, data);
+    },
+
+    testTALContent: function() { with(this) {
+      assertEqual('<span>1</span>', $("e0").innerHTML);
+      assertEqual('<span>3</span>', $("e1").innerHTML);
+      assertEqual('<span>A</span>', $("e2").innerHTML);
+      assertEqual('<span>10</span>', $("e3").innerHTML);
+    }},
+
+    testTALConditionTALContent: function() { with(this) {
+      assertEqual('<span>B</span>', $("e4").innerHTML);
+      assertEqual('', $("e5").innerHTML);
+    }},
+
+    testTALContentTALAttributes: function() { with(this) {
+      assertEqual('<span style="E">D</span>', $("e6").innerHTML);
+    }},
+
+    testTALConditionTALContentTALAttributes: function() { with(this) {
+      assertEqual('<span style="F">G</span>', $("e7").innerHTML);
+      assertEqual('', $("e8").innerHTML);
+    }},
+
+    testTALOmittagTALContent: function() { with(this) {
+      assertEqual('J', $("e9").innerHTML);
+      assertEqual('', $("e10").innerHTML);
+      assertEqual('<span>L</span>', $("e11").innerHTML);
+      assertEqual('', $("e12").innerHTML);
+    }}
+
+  });
+
+// ]]>
+</script>
+
+<div id="message"></div>
+</body>
+</html>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to