From 10bc51cf887a663010cf0bb0f9d89a1b5767a70b Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Thu, 9 Jan 2020 09:54:03 +0000 Subject: [PATCH] [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@369c20a99bd25172f72f4efde870172a4729aadc 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 --- addons/web/static/tests/views/calendar_tests.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 1a375cbf5f5..9f057a1f0dd 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -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();