Commit 72181461 authored by Ivan Tyagov's avatar Ivan Tyagov

Stop calling internal function here and there and call once in

bootstrap. Do not set any class attributes (they are useless for
RenderJs itself).
parent 457e8e95
......@@ -58,6 +58,8 @@ var RenderJs = (function () {
var gadget_id, is_gadget;
gadget_id = root.attr("id");
is_gadget = root.attr("data-gadget")!==undefined;
// this will make RenderJs fire "ready" event when all gadgets are loaded.
RenderJs.setReady(false);
if (is_gadget && gadget_id!==undefined ) {
// bootstart root gadget only if it is indeed a gadget
RenderJs.loadGadget(root);
......@@ -272,8 +274,7 @@ var RenderJs = (function () {
tab_container = $('#' + dom_id);
tab_container.empty();
html_string = [
'<div class="gadget" ',
'id="' + gadget_id + '"',
'<div id="' + gadget_id + '"',
'data-gadget="' + gadget + '"',
'data-gadget-handler="' + gadget_data_handler + '" ',
'data-gadget-source="' + gadget_data_source + '"></div>'
......@@ -285,8 +286,6 @@ var RenderJs = (function () {
// render new gadget
RenderJs.bootstrap(tab_container);
// this will make RenderJs fire "ready" event when all gadgets are loaded.
RenderJs.setReady(false);
return tab_gadget;
},
......
......@@ -69,8 +69,9 @@ function setupRenderJSTest(){
RenderJs.bindReady(function (){
start();
equal($("#qunit-fixture").children(".gadget").length, 1);
equal($("#qunit-fixture").children("#new_added").length, 1);
equal(RenderJs.GadgetIndex.getGadgetList().length, 1);
equal(RenderJs.GadgetIndex.getRootGadget().getDom().attr("id"), "new_added");
});
});
......@@ -123,7 +124,6 @@ function setupRenderJSTest(){
test('GadgetDataHandler', function () {
cleanUp();
$("#qunit-fixture").append('<div data-gadget="" id="json-gadget" data-gadget-source = "json/json_file.json" data-gadget-handler="parseJSONAndUpdateNameSpace"></div>');
RenderJs.setReady(false);
RenderJs.bootstrap($("#qunit-fixture"));
equal('', first_name);
equal('', last_name);
......
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