[IMP] web: createParent in test_utils.js

New utility function to create a parent
widget from given params that will be
given to addMockEnvironment.
This commit is contained in:
Alexandre Kühn
2017-11-02 14:20:49 +01:00
parent 9a32dacd8c
commit 98cde7ca7b
@@ -398,6 +398,19 @@ function createModel(params) {
return model;
}
/**
* 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
@@ -554,6 +567,7 @@ return $.when(
createView: createView,
createAsyncView: createAsyncView,
createModel: createModel,
createParent: createParent,
addMockEnvironment: addMockEnvironment,
dragAndDrop: dragAndDrop,
triggerMouseEvent: triggerMouseEvent,