Author: jmorliaguet Date: Sat Feb 4 14:42:59 2006 New Revision: 2286 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/__init__.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/cpsskins_storage_adapters.pt - copied unchanged from r2285, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/__init__.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/configure.zcml (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/cpsskins_storage_adapters.pt (contents, props changed) Removed: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt Modified: cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml Log:
- added "unit" tests for zope3 (they still require a browser) Modified: cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml Sat Feb 4 14:42:59 2006 @@ -11,6 +11,7 @@ name="cpsskins.css" file="cpsskins.css" layer="cpsskins" /> + <!-- Utilities, libraries --> <resource name="prototype.js" file="prototype.js" @@ -23,6 +24,14 @@ <!-- Testing --> + <resource + name="unittest.js" file="tests/unittest.js" + layer="cpsskins" /> + + <resource + name="test.css" file="tests/test.css" + layer="cpsskins" /> + <include package=".tests.zope3" /> </configure> Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml Sat Feb 4 14:42:59 2006 @@ -1,14 +1,6 @@ <configure xmlns:browser="http://namespaces.zope.org/browser"> - <browser:page - for="*" - layer="cpsskins" - name="cpsskins_storage_adapters.html" - permission="zope.Public" - template="cpsskins_storage_adapters.pt" - /> - <browser:pages layer="cpsskins" for="*" @@ -27,4 +19,8 @@ </browser:pages> + <include package=".functional" /> + + <include package=".unit" /> + </configure> Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/__init__.py ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/__init__.py Sat Feb 4 14:42:59 2006 @@ -0,0 +1 @@ +# Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml Sat Feb 4 14:42:59 2006 @@ -0,0 +1,12 @@ +<configure + xmlns:browser="http://namespaces.zope.org/browser"> + + <browser:page + for="*" + layer="cpsskins" + name="cpsskins_storage_adapters_functional.html" + permission="zope.Public" + template="cpsskins_storage_adapters.pt" + /> + +</configure> Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/__init__.py ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/__init__.py Sat Feb 4 14:42:59 2006 @@ -0,0 +1 @@ +# Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/configure.zcml ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/configure.zcml Sat Feb 4 14:42:59 2006 @@ -0,0 +1,12 @@ +<configure + xmlns:browser="http://namespaces.zope.org/browser"> + + <browser:page + for="*" + layer="cpsskins" + name="cpsskins_storage_adapters_unit.html" + permission="zope.Public" + template="cpsskins_storage_adapters.pt" + /> + +</configure> Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/cpsskins_storage_adapters.pt ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/cpsskins_storage_adapters.pt Sat Feb 4 14:42:59 2006 @@ -0,0 +1,117 @@ +<!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"> +<head> + <title>CPSSkins Unit test file</title> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <script src="/++skin++cpsskins/@@/++resource++prototype.js" + type="text/javascript"></script> + <script src="/++skin++cpsskins/@@/++resource++json.js" + type="text/javascript"></script> + <script src="/++skin++cpsskins/@@/++resource++cpsskins.js" + type="text/javascript"></script> + <script src="/++skin++cpsskins/@@/++resource++unittest.js" + type="text/javascript"></script> + <link rel="stylesheet" type="text/css" + href="/++skin++cpsskins/@@/++resource++test.css" /> + <link rel="stylesheet" type="text/css" + href="/++skin++cpsskins/@@/++resource++cpsskins.css" /> +</head> +<body> + +<h1>CPSSkins Unit test file</h1> + +<!-- Log output --> +<div id="testlog"> </div> + +<!-- Testing area --> +<div id="e0"> + + <!-- compound storages --> + <ins class="model"> + {"id": "m1", + "data": {"a": 1}, + "storage": { + "type": "volatile" + }} + </ins> + + <ins class="model"> + {"id": "m2", + "data": {"b": 2}, + "storage": { + "type": "volatile" + }} + </ins> + + <ins class="model"> + {"id": "c1", + "data": {"a": 0, "b": 0}, + "storage": { + "type": "compound", + "partitions": ["m1", "m2"] + }} + </ins> + +</div> + +<!-- Tests follow --> +<script type="text/javascript"> +// <![CDATA[ + + new Test.Unit.Runner({ + + setup: function() { + }, + + testGetData: function() { with(this) { + var model_c1 = CPSSkins.getModelById('c1'); + + assertEqual($H(model_c1.getData()).inspect(), + $H({"a": 1,"b": 2}).inspect()); + }}, + + testSetData: function() { with(this) { + var model_m1 = CPSSkins.getModelById('m1'); + var model_m2 = CPSSkins.getModelById('m2'); + var model_c1 = CPSSkins.getModelById('c1'); + + assertEqual($H(model_c1.getData()).inspect(), + $H({"a": 1, "b": 2}).inspect()); + + assertEqual($H(model_c1.schema).inspect(), + $H({'a': 'number', 'b': 'number'}).inspect()); + + assertEqual($H(model_m1.schema).inspect(), + $H({'a': 'number'}).inspect()); + + assertEqual($H(model_m2.schema).inspect(), + $H({'b': 'number'}).inspect()); + + model_c1.setData({"a": 3, "b": 1}); + assertEqual($H(model_c1.getData()).inspect(), + $H({"a": 3, "b": 1}).inspect()); + assertEqual($H(model_m1.getData()).inspect(), + $H({"a": 3}).inspect()); + assertEqual($H(model_m2.getData()).inspect(), + $H({"b": 1}).inspect()); + + model_c1.setData({"a": 4}); + assertEqual($H(model_c1.getData()).inspect(), + $H({"a": 4}).inspect()); + assertEqual($H(model_m1.getData()).inspect(), + $H({"a": 4}).inspect()); + assertEqual($H(model_m2.getData()).inspect(), + $H({}).inspect()); + + }} + + }); + +// ]]> +</script> + +</body> +</html> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins