[FIX] web: calendar's test to create an event with timezone

In `calendar_tests.js`, the tests about creating an event with timezone in
week mode only triggers 7 asserts but they were design to trigger 8 of
them.

After analysis, it looks like in the commit odoo/odoo@369c20a99b
the FullCalendar's UI was redesigned and some CSS rules might have add
some margin preventing a MouseEvent from being triggered correctly,
resulting in misadapted tests.

This commit restores the original behavior by adding some pixels to
these offsets, allowing the events to be correctly dispatched and
adapting again the tests.

Task ID: 2092550
This commit is contained in:
Romeo Fragomeli
2020-03-31 15:06:27 +00:00
committed by Pierre Paridans
parent ebce7719b6
commit 10bc51cf88
@@ -866,7 +866,7 @@ QUnit.module('Views', {
});
QUnit.test('create event with timezone in week mode with formViewDialog European locale', async function (assert) {
assert.expect(7);
assert.expect(8);
this.data.event.records = [];
this.data.event.onchanges = {
@@ -994,7 +994,7 @@ QUnit.module('Views', {
"stop": "2016-12-12 08:00:00"
};
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown");
left = calendar.$('.fc-day:eq(1)').offset().left + 5;
left = calendar.$('.fc-day:eq(1)').offset().left + 15;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(left, top, "mouseup");
await testUtils.nextTick();
@@ -1006,7 +1006,7 @@ QUnit.module('Views', {
"stop": "2016-12-12 00:00:00"
};
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown");
top = calendar.$('.fc-day:eq(1)').offset().top + 5;
top = calendar.$('.fc-day:eq(1)').offset().top + 15;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(left, top, "mouseup");
await testUtils.nextTick();
@@ -1150,7 +1150,7 @@ QUnit.module('Views', {
});
QUnit.test('create event with timezone in week mode with formViewDialog American locale', async function (assert) {
assert.expect(7);
assert.expect(8);
this.data.event.records = [];
this.data.event.onchanges = {
@@ -1278,7 +1278,7 @@ QUnit.module('Views', {
"stop": "2016-12-12 08:00:00"
};
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown");
left = calendar.$('.fc-day:eq(1)').offset().left + 5;
left = calendar.$('.fc-day:eq(1)').offset().left + 15;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(left, top, "mouseup");
await testUtils.nextTick();
@@ -1290,7 +1290,7 @@ QUnit.module('Views', {
"stop": "2016-12-12 00:00:00"
};
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown");
top = calendar.$('.fc-day:eq(1)').offset().top + 5;
top = calendar.$('.fc-day:eq(1)').offset().top + 15;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(left, top, "mouseup");
await testUtils.nextTick();