[FIX] purchase_product_matrix: test breaking in newer Chrome (rounding)

Since (at least) Chrome 94+, some element's sizing computation returns a
slightly different value (in the order of a fraction of a pixel). Sadly,
due to rounding, this difference has an impact on exact sizing
assertion.

Specifically in these drag-and-drop tests, it prevents the sorting from
being triggered as the "mouse" doesn't pass beyond the center of the
destination element (aka. next row).

By setting the position to `bottom`, this commit mitigates this issue by
making sure to pass that boundary, just like a real-user would do.

closes odoo/odoo#92292

X-original-commit: ed798b216063caa299800a56c617277aabdfb8fd
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
This commit is contained in:
Pierre Paridans
2022-05-25 18:01:03 +02:00
parent 255510d10d
commit 333a4e8733
3 changed files with 3 additions and 3 deletions
@@ -250,7 +250,7 @@ QUnit.module('section_and_note: purchase_product_matrix', {
// move first row below second
const $firstHandle = form.$('.o_data_row:nth(0) .o_row_handle');
const $secondHandle = form.$('.o_data_row:nth(1) .o_row_handle');
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle);
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle, { position: 'bottom' });
assert.strictEqual(form.$('.o_data_row').text(), 'TableChair');
@@ -90,7 +90,7 @@ odoo.define('sale.product_configurator_tests', function (require) {
// move first row below second
const $firstHandle = form.$('.o_data_row:nth(0) .o_row_handle');
const $secondHandle = form.$('.o_data_row:nth(1) .o_row_handle');
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle);
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle, { position: 'bottom' });
assert.strictEqual(form.$('.o_data_row').text(), 'TableChair');
@@ -298,7 +298,7 @@ QUnit.module('Product Configurator', {
// move first row below second
const $firstHandle = form.$('.o_data_row:nth(0) .o_row_handle');
const $secondHandle = form.$('.o_data_row:nth(1) .o_row_handle');
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle);
await testUtils.dom.dragAndDrop($firstHandle, $secondHandle, { position: 'bottom' });
assert.strictEqual(form.$('.o_data_row').text(), 'Customizable Desk (2)Customizable Desk (1)');