[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user