diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-10 15:20:01 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-10 15:20:01 +0200 |
| commit | 243a4ae5cbc07027cd3eaf0ead036b9d3586dea3 (patch) | |
| tree | a7fc43164bf3926a6c30d63f9573e6f23fc2d20c /addons/web/static/tests | |
| parent | 9530f1071d816d76194ee57711192f709e4d4d19 (diff) | |
| parent | 330b99f60c0fcc09e2438a1958d11bf7e1383d8d (diff) | |
[MERGE] forward port branch saas-12.1 up to 330b99f60c0
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/calendar_tests.js | 44 | ||||
| -rw-r--r-- | addons/web/static/tests/views/search_view_tests.js | 24 |
2 files changed, 66 insertions, 2 deletions
diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 79358530829..d369f632e56 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -44,6 +44,7 @@ QUnit.module('Views', { stop_date: {string: "stop date", type: "date"}, start: {string: "start datetime", type: "datetime"}, stop: {string: "stop datetime", type: "datetime"}, + delay: {string: "delay", type: "float"}, allday: {string: "allday", type: "boolean"}, partner_ids: {string: "attendees", type: "one2many", relation: 'partner', default: [[6, 0, [1]]]}, type: {string: "type", type: "integer"}, @@ -2395,6 +2396,49 @@ QUnit.module('Views', { calendar.destroy(); }); + QUnit.test('drag and drop on month mode with date_start and date_delay', function (assert) { + assert.expect(1); + + var calendar = createView({ + View: CalendarView, + model: 'event', + data: this.data, + arch: + '<calendar date_start="start" date_delay="delay" mode="month">'+ + '<field name="name"/>'+ + '<field name="start"/>'+ + '<field name="delay"/>'+ + '</calendar>', + archs: archs, + viewOptions: { + initialDate: initialDate, + }, + mockRPC: function (route, args) { + if (args.method === "write") { + // delay should not be written at drag and drop + assert.equal(args.args[1].delay, undefined) + } + return this._super(route, args); + }, + }); + + // 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'); + + // Move event to another day (on 27 november) + testUtils.dragAndDrop( + calendar.$('.fc-event').first(), + calendar.$('.fc-day-top').first() + ); + + calendar.destroy(); + }); + QUnit.test('form_view_id attribute works (for creating events)', function (assert) { assert.expect(1); diff --git a/addons/web/static/tests/views/search_view_tests.js b/addons/web/static/tests/views/search_view_tests.js index 30304e63fe3..f5a6a58b48d 100644 --- a/addons/web/static/tests/views/search_view_tests.js +++ b/addons/web/static/tests/views/search_view_tests.js @@ -1275,7 +1275,7 @@ QUnit.module('Search View', { }); QUnit.test('Customizing filter does not close the filter dropdown', function (assert) { - assert.expect(3); + assert.expect(5); var self = this; _.each(this.data.partner.records.slice(), function (rec) { @@ -1299,6 +1299,13 @@ QUnit.module('Search View', { 'partner,false,search': '<search><field name="date_field"/></search>', }, res_id: 1, + intercepts: { + create_filter: function (ev) { + var data = ev.data; + assert.strictEqual(data.filter.name, 'Fire on the bayou'); + assert.strictEqual(data.filter.is_default, true); + }, + }, }); testUtils.fields.many2one.clickOpenDropdown('bar'); @@ -1321,9 +1328,22 @@ QUnit.module('Search View', { $input.click(); $input.click(); }); - assert.isVisible($filterDropdown); + // Favorites Menu + var $modal = $('.modal'); + testUtils.dom.click($modal.find('.o_favorites_menu_button')); + testUtils.dom.click($modal.find('.o_add_favorite')); + $modal.find('.o_search_options .dropdown-menu').one('click', function (ev) { + // This handler is on the webClient + // But since the test suite doesn't have one + // We manually set it here + ev.stopPropagation(); + }); + testUtils.fields.editInput($modal.find('div.o_favorite_name input'), 'Fire on the bayou'); + testUtils.dom.click($modal.find('.o_add_favorite ~ div label:contains(Use by default)')); + testUtils.dom.click($modal.find('.o_save_favorite button')); + form.destroy(); }); }); |
