Commit c5ec7d2e authored by Romain Courteaud's avatar Romain Courteaud

Explicitely make local renderJS parameter non JSLint compliant.

It may help developper to see all properties which are not part of the API.
parent 76805e06
......@@ -78,12 +78,12 @@ module.exports = function (grunt) {
'QUnit',
'renderJS',
'rJS',
'RenderJSGadget',
'__RenderJSGadget',
'sinon',
'RSVP',
'DOMParser',
'RenderJSIframeGadget',
'RenderJSEmbeddedGadget'
'__RenderJSIframeGadget',
'__RenderJSEmbeddedGadget'
]
}
},
......
/*global ace */
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
......@@ -12,7 +13,7 @@
});
gk.ready(function (g) {
g.editor = ace.edit(g.element.getElementsByTagName('div')[0]);
g.editor = ace.edit(g.__element.getElementsByTagName('div')[0]);
g.editor.setTheme("ace/theme/monokai");
});
......
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
......@@ -11,11 +12,11 @@
var gk = rJS(window);
gk.declareMethod('setContent', function (value) {
this.element.getElementsByTagName('textarea')[0].value =
this.__element.getElementsByTagName('textarea')[0].value =
escape_text(value);
})
.declareMethod('getContent', function () {
return this.element.getElementsByTagName('textarea')[0].value;
return this.__element.getElementsByTagName('textarea')[0].value;
});
}(window, rJS));
/*jslint nomen: true*/
(function (window, rJS, $) {
"use strict";
......@@ -5,13 +6,13 @@
gk.declareMethod('setContent', function (value) {
// return this.context.find('textarea').val(escape_text(value));
return $(this.element).find('#textarea-b').jqteVal(value);
return $(this.__element).find('#textarea-b').jqteVal(value);
})
.declareMethod('getContent', function () {
return $(this.element).find('#textarea-b').val();
return $(this.__element).find('#textarea-b').val();
});
gk.ready(function (g) {
$(g.element).find("#textarea-b").jqte();
$(g.__element).find("#textarea-b").jqte();
});
}(window, rJS, jQuery));
/*global console */
/*jslint nomen: true*/
(function (window, $, rJS, RSVP) {
"use strict";
......@@ -6,8 +7,8 @@
var editor = all_param[0],
io = all_param[1],
id = all_param[2];
$(io.element).trigger('create');
$(editor.element).trigger('create');
$(io.__element).trigger('create');
$(editor.__element).trigger('create');
// .then(function (element) {
// element.trigger('create');
// });
......@@ -56,7 +57,7 @@
])
.then(function (all_param) {
i_c.empty();
i_c[0].appendChild(all_param[1].element);
i_c[0].appendChild(all_param[1].__element);
return attachIOToEditor(all_param);
})
.fail(handleError);
......@@ -64,8 +65,8 @@
}
rJS(window).ready(function (g) {
var editor_a_context = $(g.element).find(".editor_a").last(),
io_a_context = $(g.element).find(".editor_a_safe").last();
var editor_a_context = $(g.__element).find(".editor_a").last(),
io_a_context = $(g.__element).find(".editor_a_safe").last();
// editor_b_context = g.context.find(".editor_b").last(),
// io_b_context = g.context.find(".editor_b_safe").last();
......@@ -84,7 +85,7 @@
]);
})
.then(function (all_list) {
var panel_context = $(g.element).find(".bare_panel"),
var panel_context = $(g.__element).find(".bare_panel"),
editor_list = all_list[0],
io_list = all_list[1],
editor_definition,
......@@ -102,7 +103,7 @@
])
.then(function (all_param) {
io_a_context.empty();
io_a_context[0].appendChild(all_param[1].element);
io_a_context[0].appendChild(all_param[1].__element);
return attachIOToEditor(all_param);
})
.then(function () {
......
/*! RenderJs */
/*jslint nomen: true*/
/*
* renderJs - Generic Gadget library renderer.
......@@ -22,22 +23,22 @@
return new RenderJSGadget();
}
}
RenderJSGadget.prototype.title = "";
RenderJSGadget.prototype.interface_list = [];
RenderJSGadget.prototype.path = "";
RenderJSGadget.prototype.html = "";
RenderJSGadget.prototype.required_css_list = [];
RenderJSGadget.prototype.required_js_list = [];
RenderJSGadget.prototype.__title = "";
RenderJSGadget.prototype.__interface_list = [];
RenderJSGadget.prototype.__path = "";
RenderJSGadget.prototype.__html = "";
RenderJSGadget.prototype.__required_css_list = [];
RenderJSGadget.prototype.__required_js_list = [];
RSVP.EventTarget.mixin(RenderJSGadget.prototype);
function clearGadgetInternalParameters(g) {
g.sub_gadget_dict = {};
g.__sub_gadget_dict = {};
}
RenderJSGadget.ready_list = [clearGadgetInternalParameters];
RenderJSGadget.__ready_list = [clearGadgetInternalParameters];
RenderJSGadget.ready = function (callback) {
this.ready_list.push(callback);
this.__ready_list.push(callback);
return this;
};
......@@ -61,30 +62,30 @@
RenderJSGadget
.declareMethod('getInterfaceList', function () {
// Returns the list of gadget prototype
return this.interface_list;
return this.__interface_list;
})
.declareMethod('getRequiredCSSList', function () {
// Returns a list of CSS required by the gadget
return this.required_css_list;
return this.__required_css_list;
})
.declareMethod('getRequiredJSList', function () {
// Returns a list of JS required by the gadget
return this.required_js_list;
return this.__required_js_list;
})
.declareMethod('getPath', function () {
// Returns the path of the code of a gadget
return this.path;
return this.__path;
})
.declareMethod('getTitle', function () {
// Returns the title of a gadget
return this.title;
return this.__title;
})
.declareMethod('getElement', function () {
// Returns the DOM Element of a gadget
if (this.element === undefined) {
if (this.__element === undefined) {
throw new Error("No element defined");
}
return this.element;
return this.__element;
})
.declareMethod('acquire', function () {
var gadget = this,
......@@ -115,7 +116,7 @@
}
RenderJSGadget.call(this);
}
RenderJSEmbeddedGadget.ready_list = RenderJSGadget.ready_list.slice();
RenderJSEmbeddedGadget.__ready_list = RenderJSGadget.__ready_list.slice();
RenderJSEmbeddedGadget.ready =
RenderJSGadget.ready;
RenderJSEmbeddedGadget.prototype = new RenderJSGadget();
......@@ -143,12 +144,12 @@
// Get the gadget class and instanciate it
.push(function (Klass) {
var i,
template_node_list = Klass.template_element.body.childNodes;
template_node_list = Klass.__template_element.body.childNodes;
gadget_loading_klass = Klass;
gadget_instance = new Klass();
gadget_instance.element = options.element;
gadget_instance.__element = options.element;
for (i = 0; i < template_node_list.length; i += 1) {
gadget_instance.element.appendChild(
gadget_instance.__element.appendChild(
template_node_list[i].cloneNode(true)
);
}
......@@ -186,7 +187,7 @@
}
RenderJSGadget.call(this);
}
RenderJSIframeGadget.ready_list = RenderJSGadget.ready_list.slice();
RenderJSIframeGadget.__ready_list = RenderJSGadget.__ready_list.slice();
RenderJSIframeGadget.ready =
RenderJSGadget.ready;
RenderJSIframeGadget.prototype = new RenderJSGadget();
......@@ -223,8 +224,8 @@
iframe = document.createElement("iframe");
// gadget_instance.element.setAttribute("seamless", "seamless");
iframe.setAttribute("src", url);
gadget_instance.path = url;
gadget_instance.element = options.element;
gadget_instance.__path = url;
gadget_instance.__element = options.element;
// Attach it to the DOM
options.element.appendChild(iframe);
......@@ -232,47 +233,48 @@
// XXX Manage unbind when deleting the gadget
// Create the communication channel with the iframe
gadget_instance.chan = Channel.build({
gadget_instance.__chan = Channel.build({
window: iframe.contentWindow,
origin: "*",
scope: "renderJS"
});
// Create new method from the declareMethod call inside the iframe
gadget_instance.chan.bind("declareMethod", function (trans, method_name) {
gadget_instance[method_name] = function () {
var argument_list = arguments;
return new RSVP.Promise(function (resolve, reject) {
gadget_instance.chan.call({
method: "methodCall",
params: [
method_name,
Array.prototype.slice.call(argument_list, 0)],
success: function (s) {
resolve(s);
},
error: function (e) {
reject(e);
}
gadget_instance.__chan.bind("declareMethod",
function (trans, method_name) {
gadget_instance[method_name] = function () {
var argument_list = arguments;
return new RSVP.Promise(function (resolve, reject) {
gadget_instance.__chan.call({
method: "methodCall",
params: [
method_name,
Array.prototype.slice.call(argument_list, 0)],
success: function (s) {
resolve(s);
},
error: function (e) {
reject(e);
}
});
});
});
};
return "OK";
});
};
return "OK";
});
// Wait for the iframe to be loaded before continuing
gadget_instance.chan.bind("ready", function (trans) {
gadget_instance.__chan.bind("ready", function (trans) {
iframe_loading_deferred.resolve(gadget_instance);
return "OK";
});
gadget_instance.chan.bind("failed", function (trans, params) {
gadget_instance.__chan.bind("failed", function (trans, params) {
iframe_loading_deferred.reject(params);
return "OK";
});
gadget_instance.chan.bind("trigger", function (trans, params) {
gadget_instance.__chan.bind("trigger", function (trans, params) {
return gadget_instance.trigger(params.event_name, params.options);
});
gadget_instance.chan.bind("acquire", function (trans, params) {
gadget_instance.__chan.bind("acquire", function (trans, params) {
gadget_instance.acquire.apply(gadget_instance, params)
.then(function (g) {
trans.complete(g);
......@@ -341,17 +343,17 @@
function ready_wrapper() {
return gadget_instance;
}
for (i = 0; i < gadget_instance.constructor.ready_list.length;
for (i = 0; i < gadget_instance.constructor.__ready_list.length;
i += 1) {
// Put a timeout?
queue.push(gadget_instance.constructor.ready_list[i]);
queue.push(gadget_instance.constructor.__ready_list[i]);
// Always return the gadget instance after ready function
queue.push(ready_wrapper);
}
// Store local reference to the gadget instance
if (options.scope !== undefined) {
parent_gadget.sub_gadget_dict[options.scope] = gadget_instance;
parent_gadget.__sub_gadget_dict[options.scope] = gadget_instance;
}
return gadget_instance;
})
......@@ -365,17 +367,17 @@
return loading_gadget_promise;
})
.declareMethod('getDeclaredGadget', function (gadget_scope) {
if (!this.sub_gadget_dict.hasOwnProperty(gadget_scope)) {
if (!this.__sub_gadget_dict.hasOwnProperty(gadget_scope)) {
throw new Error("Gadget scope '" + gadget_scope + "' is not known.");
}
return this.sub_gadget_dict[gadget_scope];
return this.__sub_gadget_dict[gadget_scope];
})
.declareMethod('dropGadget', function (gadget_scope) {
if (!this.sub_gadget_dict.hasOwnProperty(gadget_scope)) {
if (!this.__sub_gadget_dict.hasOwnProperty(gadget_scope)) {
throw new Error("Gadget scope '" + gadget_scope + "' is not known.");
}
// http://perfectionkills.com/understanding-delete/
delete this.sub_gadget_dict[gadget_scope];
delete this.__sub_gadget_dict[gadget_scope];
});
/////////////////////////////////////////////////////////////////
......@@ -483,25 +485,25 @@
tmp_constructor = function () {
RenderJSGadget.call(this);
};
tmp_constructor.ready_list = RenderJSGadget.ready_list.slice();
tmp_constructor.__ready_list = RenderJSGadget.__ready_list.slice();
tmp_constructor.declareMethod =
RenderJSGadget.declareMethod;
tmp_constructor.ready =
RenderJSGadget.ready;
tmp_constructor.prototype = new RenderJSGadget();
tmp_constructor.prototype.constructor = tmp_constructor;
tmp_constructor.prototype.path = url;
tmp_constructor.prototype.__path = url;
// https://developer.mozilla.org/en-US/docs/HTML_in_XMLHttpRequest
// https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
// https://developer.mozilla.org/en-US/docs/Code_snippets/HTML_to_DOM
tmp_constructor.template_element =
tmp_constructor.__template_element =
(new DOMParser()).parseFromString(xhr.responseText, "text/html");
parsed_html = renderJS.parseGadgetHTMLDocument(
tmp_constructor.template_element
tmp_constructor.__template_element
);
for (key in parsed_html) {
if (parsed_html.hasOwnProperty(key)) {
tmp_constructor.prototype[key] = parsed_html[key];
tmp_constructor.prototype['__' + key] = parsed_html[key];
}
}
......@@ -608,9 +610,9 @@
// global
/////////////////////////////////////////////////////////////////
window.rJS = window.renderJS = renderJS;
window.RenderJSGadget = RenderJSGadget;
window.RenderJSEmbeddedGadget = RenderJSEmbeddedGadget;
window.RenderJSIframeGadget = RenderJSIframeGadget;
window.__RenderJSGadget = RenderJSGadget;
window.__RenderJSEmbeddedGadget = RenderJSEmbeddedGadget;
window.__RenderJSIframeGadget = RenderJSIframeGadget;
///////////////////////////////////////////////////
// Bootstrap process. Register the self gadget.
......@@ -639,11 +641,11 @@
RenderJSGadget.call(this);
};
tmp_constructor.declareMethod = RenderJSGadget.declareMethod;
tmp_constructor.ready_list = RenderJSGadget.ready_list.slice();
tmp_constructor.__ready_list = RenderJSGadget.__ready_list.slice();
tmp_constructor.ready = RenderJSGadget.ready;
tmp_constructor.prototype = new RenderJSGadget();
tmp_constructor.prototype.constructor = tmp_constructor;
tmp_constructor.prototype.path = url;
tmp_constructor.prototype.__path = url;
gadget_model_dict[url] = tmp_constructor;
// Create the root gadget instance and put it in the loading stack
......@@ -767,14 +769,14 @@
key;
for (key in settings) {
if (settings.hasOwnProperty(key)) {
tmp_constructor.prototype[key] = settings[key];
tmp_constructor.prototype['__' + key] = settings[key];
}
}
tmp_constructor.template_element = document.createElement("div");
root_gadget.element = document.body;
for (j = 0; j < root_gadget.element.childNodes.length; j += 1) {
tmp_constructor.template_element.appendChild(
root_gadget.element.childNodes[j].cloneNode(true)
tmp_constructor.__template_element = document.createElement("div");
root_gadget.__element = document.body;
for (j = 0; j < root_gadget.__element.childNodes.length; j += 1) {
tmp_constructor.__template_element.appendChild(
root_gadget.__element.childNodes[j].cloneNode(true)
);
}
RSVP.all([root_gadget.getRequiredJSList(),
......@@ -796,9 +798,9 @@
return root_gadget;
}
queue.push(ready_wrapper);
for (i = 0; i < tmp_constructor.ready_list.length; i += 1) {
for (i = 0; i < tmp_constructor.__ready_list.length; i += 1) {
// Put a timeout?
queue.push(tmp_constructor.ready_list[i])
queue.push(tmp_constructor.__ready_list[i])
// Always return the gadget instance after ready function
.push(ready_wrapper);
}
......
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
......@@ -11,8 +12,8 @@
return ready_called;
})
.declareMethod('isSubGadgetDictInitialize', function () {
return ((this.hasOwnProperty("sub_gadget_dict")) &&
(JSON.stringify(this.sub_gadget_dict) === "{}"));
return ((this.hasOwnProperty("__sub_gadget_dict")) &&
(JSON.stringify(this.__sub_gadget_dict) === "{}"));
})
.declareMethod('triggerError', function (value) {
throw new Error("Manually triggered embedded error");
......
/*jslint nomen: true*/
(function (document, renderJS, QUnit, sinon) {
"use strict";
var test = QUnit.test,
......@@ -9,7 +10,10 @@
deepEqual = QUnit.deepEqual,
module = QUnit.module,
root_gadget_klass = renderJS(window),
root_gadget_defer = RSVP.defer();
root_gadget_defer = RSVP.defer(),
RenderJSGadget = __RenderJSGadget,
RenderJSEmbeddedGadget = __RenderJSEmbeddedGadget,
RenderJSIframeGadget = __RenderJSIframeGadget;
// Keep track of the root gadget
renderJS(window).ready(function (g) {
......@@ -402,9 +406,9 @@
.then(function (Klass) {
var instance;
equal(Klass.prototype.path, url);
equal(Klass.prototype.foo, 'bar');
equal(Klass.template_element.nodeType, 9);
equal(Klass.prototype.__path, url);
equal(Klass.prototype.__foo, 'bar');
equal(Klass.__template_element.nodeType, 9);
instance = new Klass();
ok(instance instanceof RenderJSGadget);
......@@ -473,7 +477,7 @@
.then(function (Klass) {
var instance;
equal(Klass.prototype.path, url);
equal(Klass.prototype.__path, url);
instance = new Klass();
ok(instance instanceof RenderJSGadget);
......@@ -931,7 +935,7 @@
test('returns interface_list', function () {
// Check that getInterfaceList return a Promise
var gadget = new RenderJSGadget();
gadget.interface_list = "foo";
gadget.__interface_list = "foo";
stop();
gadget.getInterfaceList()
.then(function (result) {
......@@ -966,7 +970,7 @@
test('returns interface_list', function () {
// Check that getRequiredCSSList return a Promise
var gadget = new RenderJSGadget();
gadget.required_css_list = "foo";
gadget.__required_css_list = "foo";
stop();
gadget.getRequiredCSSList()
.then(function (result) {
......@@ -1001,7 +1005,7 @@
test('returns interface_list', function () {
// Check that getRequiredJSList return a Promise
var gadget = new RenderJSGadget();
gadget.required_js_list = "foo";
gadget.__required_js_list = "foo";
stop();
gadget.getRequiredJSList()
.then(function (result) {
......@@ -1036,7 +1040,7 @@
test('returns path', function () {
// Check that getPath return a Promise
var gadget = new RenderJSGadget();
gadget.path = "foo";
gadget.__path = "foo";
stop();
gadget.getPath()
.then(function (result) {
......@@ -1071,7 +1075,7 @@
test('returns title', function () {
// Check that getTitle return a Promise
var gadget = new RenderJSGadget();
gadget.title = "foo";
gadget.__title = "foo";
stop();
gadget.getTitle()
.then(function (result) {
......@@ -1106,7 +1110,7 @@
test('returns element property', function () {
// Check that getElement return a Promise
var gadget = new RenderJSGadget();
gadget.element = "foo";
gadget.__element = "foo";
stop();
gadget.getElement()
.then(function (result) {
......@@ -1461,7 +1465,7 @@
}, result;
Klass.prototype = new RenderJSGadget();
Klass.prototype.constructor = Klass;
Klass.ready_list = [];
Klass.__ready_list = [];
Klass.ready = RenderJSGadget.ready;
result = Klass.ready(function () {
......@@ -1481,12 +1485,12 @@
callback = function () {return; };
Klass.prototype = new RenderJSGadget();
Klass.prototype.constructor = Klass;
Klass.ready_list = [];
Klass.__ready_list = [];
Klass.ready = RenderJSGadget.ready;
Klass.ready(callback);
// ready is chainable
deepEqual(Klass.ready_list, [callback]);
deepEqual(Klass.__ready_list, [callback]);
});
/////////////////////////////////////////////////////////////////
......@@ -1639,7 +1643,7 @@
stop();
gadget.declareGadget(url)//, document.getElementById('qunit-fixture'))
.then(function (new_gadget) {
equal(new_gadget.path, url);
equal(new_gadget.__path, url);
ok(new_gadget instanceof RenderJSGadget);
})
.always(function () {
......@@ -1664,8 +1668,8 @@
stop();
gadget.declareGadget(url)//, document.getElementById('qunit-fixture'))
.then(function (new_gadget) {
ok(new_gadget.hasOwnProperty("sub_gadget_dict"));
deepEqual(new_gadget.sub_gadget_dict, {});
ok(new_gadget.hasOwnProperty("__sub_gadget_dict"));
deepEqual(new_gadget.__sub_gadget_dict, {});
})
.always(function () {
start();
......@@ -1734,7 +1738,7 @@
.then(function (new_gadget) {
equal(document.getElementById('qunit-fixture').innerHTML,
"<div>youhou2</div><div>bar</div>");
equal(new_gadget.element.outerHTML,
equal(new_gadget.__element.outerHTML,
"<div><p>Bar content</p></div>");
ok(spy_js.calledTwice, "JS count " + spy_js.callCount);
equal(spy_js.firstCall.args[0], js1_url, "First JS call");
......@@ -2047,7 +2051,7 @@
// Subclass RenderJSGadget to not pollute its namespace
var gadget = new RenderJSGadget(),
html_url = 'https://example.org/files/qunittest/test98.html';
gadget.sub_gadget_dict = {};
gadget.__sub_gadget_dict = {};
this.server.respondWith("GET", html_url, [200, {
"Content-Type": "text/html"
......@@ -2063,8 +2067,8 @@
);
})
.then(function (child_gadget) {
ok(gadget.sub_gadget_dict.hasOwnProperty("foo"));
equal(gadget.sub_gadget_dict.foo, child_gadget);
ok(gadget.__sub_gadget_dict.hasOwnProperty("foo"));
equal(gadget.__sub_gadget_dict.foo, child_gadget);
})
.fail(function (e) {
ok(false, e);
......@@ -2184,7 +2188,7 @@
// Subclass RenderJSGadget to not pollute its namespace
var gadget = new RenderJSGadget(),
url = "./embedded.html";
gadget.sub_gadget_dict = {};
gadget.__sub_gadget_dict = {};
document.getElementById("qunit-fixture").textContent = "";
......@@ -2195,8 +2199,8 @@
scope: "foo"
})
.then(function (child_gadget) {
ok(gadget.sub_gadget_dict.hasOwnProperty("foo"));
equal(gadget.sub_gadget_dict.foo, child_gadget);
ok(gadget.__sub_gadget_dict.hasOwnProperty("foo"));
equal(gadget.__sub_gadget_dict.foo, child_gadget);
})
.fail(function (e) {
ok(false, e);
......@@ -2219,13 +2223,13 @@
element: document.getElementById('qunit-fixture')
})
.then(function (new_gadget) {
equal(new_gadget.path, url);
equal(new_gadget.__path, url);
ok(new_gadget instanceof RenderJSIframeGadget);
equal(
new_gadget.element.innerHTML,
new_gadget.__element.innerHTML,
'<iframe src="' + url + '"></iframe>'
);
ok(new_gadget.chan !== undefined);
ok(new_gadget.__chan !== undefined);
})
.always(function () {
start();
......@@ -2245,8 +2249,8 @@
element: document.getElementById('qunit-fixture')
})
.then(function (new_gadget) {
ok(new_gadget.hasOwnProperty("sub_gadget_dict"));
deepEqual(new_gadget.sub_gadget_dict, {});
ok(new_gadget.hasOwnProperty("__sub_gadget_dict"));
deepEqual(new_gadget.__sub_gadget_dict, {});
})
.always(function () {
start();
......@@ -2413,7 +2417,7 @@
test('returns value from sub_gadget_dict attribute', function () {
// Check that getDeclaredGadget return a Promise
var gadget = new RenderJSGadget();
gadget.sub_gadget_dict = {foo: "bar"};
gadget.__sub_gadget_dict = {foo: "bar"};
stop();
gadget.getDeclaredGadget("foo")
.then(function (result) {
......@@ -2427,7 +2431,7 @@
test('throw an error if scope is unknown', function () {
// Check that getDeclaredGadget return a Promise
var gadget = new RenderJSGadget();
gadget.sub_gadget_dict = {};
gadget.__sub_gadget_dict = {};
stop();
gadget.getDeclaredGadget("foo")
.then(function () {
......@@ -2453,12 +2457,12 @@
test('returns value from sub_gadget_dict attribute', function () {
// Check that dropGadget return a Promise
var gadget = new RenderJSGadget();
gadget.sub_gadget_dict = {foo: "bar"};
gadget.__sub_gadget_dict = {foo: "bar"};
stop();
gadget.dropGadget("foo")
.then(function (result) {
equal(result, undefined);
equal(JSON.stringify(gadget.sub_gadget_dict), "{}");
equal(JSON.stringify(gadget.__sub_gadget_dict), "{}");
})
.always(function () {
start();
......@@ -2468,7 +2472,7 @@
test('throw an error if scope is unknown', function () {
// Check that dropGadget return a Promise
var gadget = new RenderJSGadget();
gadget.sub_gadget_dict = {};
gadget.__sub_gadget_dict = {};
stop();
gadget.dropGadget("foo")
.then(function () {
......@@ -2499,33 +2503,33 @@
root_gadget_defer.promise
.then(function (root_gadget) {
// Check instance
equal(root_gadget.path, window.location.href);
equal(root_gadget.title, document.title);
deepEqual(root_gadget.interface_list, []);
deepEqual(root_gadget.required_css_list,
equal(root_gadget.__path, window.location.href);
equal(root_gadget.__title, document.title);
deepEqual(root_gadget.__interface_list, []);
deepEqual(root_gadget.__required_css_list,
["../node_modules/grunt-contrib-qunit/test/libs/qunit.css"]);
deepEqual(root_gadget.required_js_list, [
deepEqual(root_gadget.__required_js_list, [
"../node_modules/rsvp/dist/rsvp-2.0.4.js",
"../node_modules/grunt-contrib-qunit/test/libs/qunit.js",
"../node_modules/sinon/pkg/sinon.js",
"../dist/renderjs-latest.js",
"renderjs_test.js"
]);
equal(root_gadget.element.outerHTML, document.body.outerHTML);
equal(root_gadget.__element.outerHTML, document.body.outerHTML);
// Check klass
equal(root_gadget.constructor.prototype.path, window.location.href);
equal(root_gadget.constructor.prototype.title, document.title);
deepEqual(root_gadget.constructor.prototype.interface_list, []);
deepEqual(root_gadget.constructor.prototype.required_css_list,
equal(root_gadget.constructor.prototype.__path, window.location.href);
equal(root_gadget.constructor.prototype.__title, document.title);
deepEqual(root_gadget.constructor.prototype.__interface_list, []);
deepEqual(root_gadget.constructor.prototype.__required_css_list,
["../node_modules/grunt-contrib-qunit/test/libs/qunit.css"]);
deepEqual(root_gadget.constructor.prototype.required_js_list, [
deepEqual(root_gadget.constructor.prototype.__required_js_list, [
"../node_modules/rsvp/dist/rsvp-2.0.4.js",
"../node_modules/grunt-contrib-qunit/test/libs/qunit.js",
"../node_modules/sinon/pkg/sinon.js",
"../dist/renderjs-latest.js",
"renderjs_test.js"
]);
var html = root_gadget.constructor.template_element.outerHTML;
var html = root_gadget.constructor.__template_element.outerHTML;
ok(/^<div>\s*<h1 id="qunit-header">/.test(html), html);
ok(root_gadget.on !== undefined);
ok(root_gadget.off !== undefined);
......@@ -2533,8 +2537,8 @@
ok(root_gadget instanceof RenderJSGadget);
ok(root_gadget_klass, root_gadget.constructor);
ok(root_gadget.aq_parent !== undefined);
ok(root_gadget.hasOwnProperty("sub_gadget_dict"));
deepEqual(root_gadget.sub_gadget_dict, {});
ok(root_gadget.hasOwnProperty("__sub_gadget_dict"));
deepEqual(root_gadget.__sub_gadget_dict, {});
})
.fail(function (e) {
ok(false, e);
......
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