Author: jmorliaguet
Date: Mon Jan 30 20:53:01 2006
New Revision: 2253

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
Log:

- cosmetic

- new tests



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Jan 30 
20:53:01 2006
@@ -358,7 +358,7 @@
 
   getModel: function(node) {
     if (!node) return null;
-    var model_node = this.getModelNode(node);
+    var model_node = this._getModelNode(node);
     if (model_node) {
       var name = model_node.getAttribute("name");
       return CPSSkins.Models[name];
@@ -366,7 +366,7 @@
     return null;
   },
 
-  getModelNode: function(node) {
+  _getModelNode: function(node) {
     while(node = node.previousSibling) {
       if (node.nodeType == 1) {
         if (node && node.tagName.toLowerCase() == "ins"

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    Mon Jan 30 20:53:01 2006
@@ -25,15 +25,22 @@
 <!-- Log output -->
 <div id="testlog"> </div>
 
+<ins class="controller">
+{"id": "c1"
+}
+</ins>
+
 <!-- Testing area -->
 <div id="e0">
   <div>
+
     <div id="e1"></div>
     <div>
 
       <ins class="model">
-      {"data":  {
-        "a":"1","b":"2"
+      {"id": "m1",
+       "data":  {
+         "a":"1","b":"2"
       }}
       </ins>
 
@@ -42,8 +49,9 @@
       <div id="e4">
 
         <ins class="model">
-        {"data": {
-          "a":"1"
+        {"id": "m2",
+         "data": {
+           "a":"1"
         }}
         </ins>
         <div></div>
@@ -54,7 +62,8 @@
     <div></div>
 
     <ins class="model">
-    {"data": {
+    {"id": "m3",
+     "data": {
       "a":["1","2","3"],
       "b":{"c":1,"d":2},
       "c":[[1],[2],[3]]
@@ -137,11 +146,36 @@
     return $(element).style.display != 'none';
   }
 
+  function handler() {
+  }
+
   new Test.Unit.Runner({
 
     setup: function() {
     },
 
+    /* CPSSkins */
+    testGetModelById: function() { with(this) {
+      assertEqual(CPSSkins.getModelById("m1").def.id, "m1");
+      assertEqual(CPSSkins.getModelById("m2").def.id, "m2");
+      assertEqual(CPSSkins.getModelById("m3").def.id, "m3");
+      assertEqual(CPSSkins.getModelById("m4"), null);
+    }},
+
+    testGetControllerById: function() { with(this) {
+      assertEqual(CPSSkins.getControllerById("c1").def.id, "c1");
+      assertEqual(CPSSkins.getControllerById("c2"), null);
+    }},
+
+    testRegisterHandlers: function() { with(this) {
+      assertEqual($H(CPSSkins.Handlers).inspect(),
+                  $H({}).inspect())
+      CPSSkins.registerHandlers({'handler': handler});
+      assertEqual($H(CPSSkins.Handlers).inspect(),
+                  $H({'handler': handler}).inspect())
+    }},
+
+    /* Identifiable */
     testIsIdentifiable: function() { with(this) {
       assertEqual(Identifiable.isIdentifiable(e1), true);
       assertEqual(Identifiable.isIdentifiable(e1.parentNode), false);
@@ -200,6 +234,18 @@
       assertEqual(Identifiable.isEmpty(e6), true);
     }},
 
+    /* Canvas */
+
+    testGetModelNode: function() { with(this) {
+      assertEqual(Canvas._getModelNode(e0), null);
+      assertEqual(Canvas._getModelNode(e1), null);
+      assertNotEqual(Canvas._getModelNode(e2), null);
+      assertEqual(Canvas._getModelNode(e3), null);
+      assertEqual(Canvas._getModelNode(e4), null);
+      assertEqual(Canvas._getModelNode(e5), null);
+      assertEqual(Canvas._getModelNode(e6), null);
+    }},
+
     testGetModel: function() { with(this) {
       assertEqual(Canvas.getModel(e0), null);
       assertEqual(Canvas.getModel(e1), null);

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    Mon Jan 30 20:53:01 2006
@@ -28,7 +28,6 @@
 
     input {
       margin-bottom: 0.5em;
-      margin-top: 0.5em;
       border-width: 1px;
       border-style: solid;
       border-color: #000 #999 #999 #000;
@@ -46,7 +45,7 @@
       border: 1px solid #000;
       background-color: #fc0;
       padding: 0.5em;
-      margin-bottom: 0.5em;
+      margin-bottom: 1em;
     } 
   </style>
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to