Commit e48da313 authored by Ivan Tyagov's avatar Ivan Tyagov

Update to recent RenderJS.

Test were moved to RenderJS's repository.
parent 533e6caa
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts37339345.5</string> </value>
<value> <string>ts46068994.72</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -53,7 +53,7 @@ var RenderJs = (function () {\n
load: function (root) {\n
/* Load gadget layout by traversing DOM */\n
var gadget_list;\n
gadget_list = root.find("[gadget]");\n
gadget_list = root.find("[data-gadget]");\n
// Load chilren\n
gadget_list.each(function() {\n
RenderJs.loadGadgetFromUrl($(this));\n
......@@ -70,7 +70,7 @@ var RenderJs = (function () {\n
loadGadgetFromUrl: function(gadget) {\n
/* Load gadget\'s SPECs from URL */\n
var url, gadget_id, gadget_property, cacheable, cache_id, app_cache, data, gadget_js;\n
url = gadget.attr("gadget");\n
url = gadget.attr("data-gadget");\n
gadget_id = gadget.attr("id");\n
\n
// register gadget in javascript namespace\n
......@@ -78,7 +78,7 @@ var RenderJs = (function () {\n
RenderJs.GadgetIndex.registerGadget(gadget_js);\n
\n
if (url!==undefined && url!==""){\n
gadget_property = gadget.attr("gadget:property");\n
gadget_property = gadget.attr("data-gadget:property");\n
cacheable = false;\n
if (gadget_property!==undefined) {\n
gadget_property = $.parseJSON(gadget_property);\n
......@@ -91,13 +91,11 @@ var RenderJs = (function () {\n
app_cache = RenderJs.Cache.get(cache_id, undefined);\n
if(app_cache===undefined || app_cache===null){\n
// not in cache so we pull from network and cache\n
//console.log("not in cache: " + cache_id + " " + url);\n
$.ajax({url:url,\n
yourCustomData: {"gadget_id": gadget_id, "cache_id": cache_id},\n
success: function (data) {\n
cache_id = this.yourCustomData.cache_id;\n
gadget_id = this.yourCustomData.gadget_id;\n
//console.log("set in cache: " + cache_id);\n
RenderJs.Cache.set(cache_id, data);\n
RenderJs.GadgetIndex.getGadgetById(gadget_id).setReady();\n
RenderJs.updateAndRecurse(gadget, data);\n
......@@ -114,7 +112,6 @@ var RenderJs = (function () {\n
}\n
else {\n
// not to be cached\n
//console.log("Not to be cached " + url + gadget_id);\n
$.ajax({url:url,\n
yourCustomData: {"gadget_id": gadget_id},\n
success: function (data) {\n
......@@ -153,9 +150,7 @@ var RenderJs = (function () {\n
var is_gadget_list_loaded;\n
is_gadget_list_loaded = RenderJs.GadgetIndex.isGadgetListLoaded();\n
if (is_gadget_list_loaded){\n
//console.log("to trigger ");\n
if (!RenderJs.isReady()) {\n
//console.log("trigger ", RenderJs.GadgetIndex.getGadgetList());\n
RenderJs.GadgetIndex.getRootGadget().getDom().trigger("ready");\n
RenderJs.setReady(true);\n
}\n
......@@ -180,8 +175,8 @@ var RenderJs = (function () {\n
updateGadgetData: function(gadget) {\n
/* Do real gagdet update here */\n
var data_source, data_handler;\n
data_source = gadget.attr("gadget:data-source");\n
data_handler = gadget.attr("gadget:data-handler");\n
data_source = gadget.attr("data-gadget:data-source");\n
data_handler = gadget.attr("data-gadget:data-handler");\n
// acquire data and pass it to method handler\n
if (data_source!==undefined){\n
$.ajax({url:data_source,\n
......@@ -334,9 +329,9 @@ var RenderJs = (function () {\n
tab_container=$(\'#\'+dom_id);\n
tab_container.empty();\n
html_string =[\'<div class="gadget" \',\n
\'gadget="\' + gadget + \'"\',\n
\'gadget:data-handler="\' + gadget_data_handler + \'" \',\n
\'gadget:data-source="\' + gadget_data_source +\'"></div>\'].join(\'\\n\');\n
\'data-gadget="\' + gadget + \'"\',\n
\'data-gadget:data-handler="\' + gadget_data_handler + \'" \',\n
\'data-gadget:data-source="\' + gadget_data_source +\'"></div>\'].join(\'\\n\');\n
\n
tab_container.append(html_string);\n
tab_gadget = tab_container.find(".gadget");\n
......@@ -473,7 +468,6 @@ var RenderJs = (function () {\n
func = new Function(func_body);\n
source_gadget.dom.bind(source_method_id, func);\n
}\n
console.log(source_gadget_id, \'.\', source_method_id, \'-->\', destination_gadget_id, \'.\', destination_method_id);\n
}\n
);\n
}\n
......@@ -489,7 +483,7 @@ var RenderJs = (function () {\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>19475</int> </value>
<value> <int>18997</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts37322419.16</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>renderjs_test.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
function setupRenderJSTest(){\n
/*\n
* Main RenderJS test entry point\n
*/\n
module("Cache");\n
test(\'Cache\', function(){\n
cache_id = \'my_test\';\n
data = {\'gg\':1};\n
RenderJs.Cache.set(cache_id, data);\n
deepEqual(data, RenderJs.Cache.get(cache_id));\n
});\n
\n
\n
module("TabularGadget");\n
test(\'addNewTabGadget\', function(){\n
RenderJs.TabbularGadget.addNewTabGadget("qunit-fixture", "Person_view/Form_asRenderJSGadget", "ERP5Form.update", "Form_asJSON?form_id=Person_view");\n
equal($("#qunit-fixture").children(".gadget").length, 1);\n
equal(RenderJs.GadgetIndex.getGadgetList().length, 1);\n
\n
});\n
\n
module("GadgetIndex");\n
test(\'GadgetIndex\', function(){\n
// re-init GadgetIndex\n
$.each(RenderJs.GadgetIndex.getGadgetList(), function () {\n
RenderJs.GadgetIndex.unregisterGadget(this);\n
});\n
\n
$("#qunit-fixture").append(\'<div gadget="" id="new">XXXXXXXXXXXX</div>\');\n
RenderJs.bootstrap($("#qunit-fixture"));\n
RenderJs.GadgetIndex.getRootGadget().getDom().one("ready", function (){\n
RenderJs.update($("#qunit-fixture"));\n
});\n
equal(RenderJs.GadgetIndex.getGadgetList().length, 2);\n
equal(true, RenderJs.GadgetIndex.isGadgetListLoaded());\n
equal($("#qunit-fixture").attr("id"), RenderJs.GadgetIndex.getRootGadget().getDom().attr("id"));\n
equal(RenderJs.GadgetIndex.getGadgetById("qunit-fixture"), RenderJs.GadgetIndex.getRootGadget());\n
\n
// unregister gadget\n
RenderJs.GadgetIndex.unregisterGadget(RenderJs.GadgetIndex.getGadgetById("qunit-fixture"));\n
equal(RenderJs.GadgetIndex.getGadgetList().length, 1);\n
equal(RenderJs.GadgetIndex.getGadgetById("new"), RenderJs.GadgetIndex.getRootGadget());\n
\n
\n
});\n
\n
};\n
\n
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1962</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_renderjs</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode>\074!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n
"http://www.w3.org/TR/html4/loose.dtd"\076\n
\074html\076\n
\074head\076\n
\074link rel="stylesheet" href="jquery/plugin/qunit/qunit.css" type="text/css"/\076\n
\074script src="jquery/core/jquery.js"\076 \074/script\076\n
\074script src="jquery/plugin/qunit/qunit.js" type="text/javascript"\076\074/script\076\n
\074script type="text/javascript" src="jquery/plugin/renderjs/renderjs.js"\076\074/script\076\n
\074!--[if IE]\076\n
\074script type="text/javascript" src="jquery/plugin/jstorage/jquery.json-2.3.js"\076\074/script\076\n
\074!--\074![endif]--\076\n
\074script type="text/javascript" src="jquery/plugin/jstorage/jstorage.js"\076\074/script\076\n
\074script type="text/javascript" src="jquery/plugin/renderjs/renderjs_test.js"\076\074/script\076\n
\n
\074/head\076\n
\074body\076\n
\074h1 id="qunit-header"\076QUnit RenderJS test suite\074/h1\076\n
\074h2 id="qunit-banner"\076\074/h2\076\n
\074h2 id="qunit-userAgent"\076\074/h2\076\n
\074ol id="qunit-tests"\076\n
\074/ol\076\n
\074div id="qunit-fixture"\076 \074/div\076\n
\n
\074script type="text/javascript"\076\n
//\074![CDATA[\n
$(document).ready(setupRenderJSTest());\n
//]]\076\n
\074/script\076\n
\n
\n
\074/body\076\n
\074/html\076</unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_viewRenderJSQunitTestRunner</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
19
\ No newline at end of file
20
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment