[IMP] web: ctrlKey option in dragAndDrop

The gantt view allows the dragged pill to be copied when
the key ctrl (or command) is pressed. In order to be
able to test that feature, we had to modify
testUtils.dragAndDrop. This is done in the present
commit.

closes odoo/odoo#37074

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
This commit is contained in:
Mathieu Duckerts-Antoine
2019-09-19 08:20:50 +00:00
parent 948ce04649
commit 3e21daaf45
@@ -40,6 +40,7 @@ var concurrency = require('web.concurrency');
* @param {jQuery|HTMLElement} [options.mousedownTarget=undefined] target of the mousedown event
* @param {jQuery|HTMLElement} [options.mousemoveTarget=undefined] target of the mousemove event
* @param {jQuery|HTMLElement} [options.mouseupTarget=undefined] target of the mouseup event
* @param {jQuery|HTMLElement} [options.ctrlKey=undefined] if the ctrl key should be considered pressed at the time of mouseup
* @returns {Promise}
*/
function dragAndDrop($el, $to, options) {
@@ -102,7 +103,8 @@ function dragAndDrop($el, $to, options) {
triggerEvent(options.mouseupTarget || el || $el, 'mouseup', {
which: 1,
pageX: toOffset.left,
pageY: toOffset.top
pageY: toOffset.top,
ctrlKey: options.ctrlKey,
});
if (options.withTrailingClick) {
triggerEvent(options.mouseupTarget || el || $el, 'click');