summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_create.js
diff options
context:
space:
mode:
authorRomeo Fragomeli <rfr@odoo.com>2019-12-12 11:55:40 +0000
committerPierre Paridans <app@odoo.com>2020-03-31 15:06:11 +0000
commitebce7719b624136da2b26a73acf8930538c7a38c (patch)
treec89870d188705a37dee60e69aed2dd6e9eee524b /addons/web/static/tests/helpers/test_utils_create.js
parentd2851b203924dcb0e56e534751a552e99757971b (diff)
[REF] calendar,web: update to FullCalendar v4
This commit updates the FullCalendar library from v3 to v4. The purpose of this update for us is to add a proper support of the drag-and-drop of events on mobile. But also to fix scrolling issues present mainly on smaller screens. In those configurations multi/inner-scrolls were present resulting into either the inability to properly scroll the desired content or even blocking alltogether the scroll. As a nice-to-have feature, the version 4 removes its dependency on the jQuery library, allowing a faster loading of a bigger set of events. Last but not least, this version also reduces its dependency on the Moment.js library (but still keeps a binding to it for compatibility purpose). This commit focus only on the update of the library itself and the adaptation of the related code to keep it working. Further enhancements/fixes will be done later on. To do so it modifies the following points: * Update the library in itself (js, css...). * Convert all FullCalendar's method calls to the new syntax (e.g. `$calendar.fullCalendar('destroy')` becomes `calendar.destroy()`). * Add a utility method to convert v4 events into the old v3 event structure to ease the transition from one version to the other. * Wrap all event's custom fields into a new event's `extendedProps` object (as its the new way of storing them instead of directly as a prop. of the event). * Adapt `slotLabelFormat` and `weekNumberCalculation`. * Use the view's new names: ** `agendaDay` -> `timeGridDay` ** `agendaWeek` -> `timeGridWeek` ** `month` -> `dayGridMonth` * Use the option's new names: ** `viewRender` -> `datesRender` ** `eventMouseover` -> `eventMouseEnter` ** `eventMouseout` -> `eventMouseLeave` ** `isRTL` -> `dir` ** `selectHelper` -> `selectMirror` ** `weekNumberTitle` -> `weekLabel` Ref: https://fullcalendar.io/docs/upgrading-from-v3 Task ID: 2092550
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_create.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils_create.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_create.js b/addons/web/static/tests/helpers/test_utils_create.js
index 8130e74ba03..494a0aa2436 100644
--- a/addons/web/static/tests/helpers/test_utils_create.js
+++ b/addons/web/static/tests/helpers/test_utils_create.js
@@ -106,7 +106,12 @@ odoo.define('web.test_utils_create', function (require) {
return calendar;
}
const viewElements = [...document.getElementById('qunit-fixture').children];
+ // prepend reset the scrollTop to zero so we restore it manually
+ let fcScroller = document.querySelector('.fc-scroller');
+ const scrollPosition = fcScroller.scrollTop;
viewElements.forEach(el => document.body.prepend(el));
+ fcScroller = document.querySelector('.fc-scroller');
+ fcScroller.scrollTop = scrollPosition;
const destroy = calendar.destroy;
calendar.destroy = () => {