summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils.js
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2017-11-02 13:03:44 +0100
committerAlexandre Kühn <aku@odoo.com>2017-11-02 14:20:49 +0100
commit98cde7ca7b570b52c2b47af7547e6ec1da3a2071 (patch)
tree4439c7fc4769896140ce8cddc3ebd6277cd9df08 /addons/web/static/tests/helpers/test_utils.js
parent9a32dacd8c30860b24ea191f16f7d0ade6d9c3b2 (diff)
[IMP] web: createParent in test_utils.js
New utility function to create a parent widget from given params that will be given to addMockEnvironment.
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js
index a8a4612b38f..9ab53186c1e 100644
--- a/addons/web/static/tests/helpers/test_utils.js
+++ b/addons/web/static/tests/helpers/test_utils.js
@@ -399,6 +399,19 @@ function createModel(params) {
}
/**
+ * create a widget parent from given parameters.
+ *
+ * @param {Object} params This object will be given to addMockEnvironment, so
+ * any parameters from that method applies
+ * @returns {Widget}
+ */
+function createParent(params) {
+ var widget = new Widget();
+ addMockEnvironment(widget, params);
+ return widget;
+}
+
+/**
* simulate a drag and drop operation between 2 jquery nodes: $el and $to.
* This is a crude simulation, with only the mousedown, mousemove and mouseup
* events, but it is enough to help test drag and drop operations with jqueryUI
@@ -554,6 +567,7 @@ return $.when(
createView: createView,
createAsyncView: createAsyncView,
createModel: createModel,
+ createParent: createParent,
addMockEnvironment: addMockEnvironment,
dragAndDrop: dragAndDrop,
triggerMouseEvent: triggerMouseEvent,