diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-02 10:59:21 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-02 10:59:21 +0200 |
| commit | 2c68df0ab43cb42e6762d7a1929471bf3f3df920 (patch) | |
| tree | 6b50e22be60152c7d6218d791076fe4a4457bd4e /addons/web/static/tests | |
| parent | b1530265e4b5ef6dc67919154f6827ff36f6aae3 (diff) | |
| parent | 82c901c93797b15ab33b5e784450e147c1bc3ba8 (diff) | |
[MERGE] forward port branch 11.0 up to 82c901c9379
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/calendar_tests.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 4414d48d47a..63da502859b 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -2236,6 +2236,67 @@ QUnit.module('Views', { calendar.destroy(); }); + QUnit.test('timzeone does not affect calendar with date field', function (assert) { + assert.expect(8); + + var calendar = createView({ + View: CalendarView, + model: 'event', + data: this.data, + arch: + '<calendar date_start="start_date" mode="month">'+ + '<field name="name"/>'+ + '<field name="start_date"/>'+ + '</calendar>', + archs: archs, + viewOptions: { + initialDate: initialDate, + }, + mockRPC: function (route, args) { + if (args.method === "create") { + assert.strictEqual(args.args[0].start_date, "2016-12-20 00:00:00"); + } + if (args.method === "write") { + assert.step(args.args[1].start_date); + } + return this._super(route, args); + }, + session: { + getTZOffset: function () { + return 120; // 2 hours timezone + }, + }, + }); + + // Create event (on 20 december) + var $cell = calendar.$('.fc-day-grid .fc-row:eq(3) .fc-day:eq(2)'); + testUtils.triggerMouseEvent($cell, "mousedown"); + testUtils.triggerMouseEvent($cell, "mouseup"); + var $input = $('.modal-body input:first'); + $input.val("An event").trigger('input'); + $('.modal button.btn:contains(Create)').trigger('click'); + + assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "12/20/2016") + + // Move event to another day (on 27 november) + testUtils.dragAndDrop( + calendar.$('.fc-event').first(), + calendar.$('.fc-day-top').first() + ); + assert.verifySteps(["2016-11-27 00:00:00"]); + assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "11/27/2016") + + // Move event to last day (on 7 january) + testUtils.dragAndDrop( + calendar.$('.fc-event').first(), + calendar.$('.fc-day-top').last() + ); + assert.verifySteps(["2016-11-27 00:00:00", "2017-01-07 00:00:00"]); + assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "01/07/2017") + + calendar.destroy(); + }); + QUnit.test('form_view_id attribute works (for creating events)', function (assert) { assert.expect(1); |
