Commit 8971cb24 authored by Ivan Tyagov's avatar Ivan Tyagov

Add tests from ERP5's business template which used ti be place holder of

RenderJS.
parent 3aed3a8c
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="../../../lib/qunit/qunit.css" type="text/css"/>
<script src="../../../lib/jquery/jquery.js"> </script>
<script src="../../../lib/qunit/qunit.js" type="text/javascript"></script>
<script type="text/javascript" src="../renderjs.js"></script>
<!--[if IE]>
<script type="text/javascript" src="jquery/plugin/jstorage/jquery.json-2.3.js"></script>
<!--<![endif]-->
<script type="text/javascript" src="../../../lib/jstorage/jstorage.js"></script>
<script type="text/javascript" src="renderjs_test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit RenderJS test suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="qunit-fixture"> </div>
<script type="text/javascript">
//<![CDATA[
$(document).ready(setupRenderJSTest());
//]]>
</script>
</body>
</html>
\ No newline at end of file
function setupRenderJSTest(){
/*
* Main RenderJS test entry point
*/
module("Cache");
test('Cache', function(){
cache_id = 'my_test';
data = {'gg':1};
RenderJs.Cache.set(cache_id, data);
deepEqual(data, RenderJs.Cache.get(cache_id));
});
// module("TabularGadget");
// test('addNewTabGadget', function(){
// RenderJs.TabbularGadget.addNewTabGadget("qunit-fixture", "Person_view/Form_asRenderJSGadget", "ERP5Form.update", "Form_asJSON?form_id=Person_view");
// equal($("#qunit-fixture").children(".gadget").length, 1);
// equal(RenderJs.GadgetIndex.getGadgetList().length, 1);
//
// });
module("GadgetIndex");
test('GadgetIndex', function(){
// re-init GadgetIndex
$.each(RenderJs.GadgetIndex.getGadgetList(), function () {
RenderJs.GadgetIndex.unregisterGadget(this);
});
$("#qunit-fixture").append('<div gadget="" id="new">XXXXXXXXXXXX</div>');
RenderJs.bootstrap($("#qunit-fixture"));
RenderJs.GadgetIndex.getRootGadget().getDom().one("ready", function (){
RenderJs.update($("#qunit-fixture"));
});
equal(RenderJs.GadgetIndex.getGadgetList().length, 2);
equal(true, RenderJs.GadgetIndex.isGadgetListLoaded());
equal($("#qunit-fixture").attr("id"), RenderJs.GadgetIndex.getRootGadget().getDom().attr("id"));
equal(RenderJs.GadgetIndex.getGadgetById("qunit-fixture"), RenderJs.GadgetIndex.getRootGadget());
// unregister gadget
RenderJs.GadgetIndex.unregisterGadget(RenderJs.GadgetIndex.getGadgetById("qunit-fixture"));
equal(RenderJs.GadgetIndex.getGadgetList().length, 1);
equal(RenderJs.GadgetIndex.getGadgetById("new"), RenderJs.GadgetIndex.getRootGadget());
});
};
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