From 868bad0259922902a3276b0c4cf141efaadb206b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 6 Aug 2019 14:01:23 +0000 Subject: [FIX] web: quick create in RTL - Set a language using RTL (e.g. Arabic) - Activate mobile mode (through debug mode or on a mobile device) - Go to the CRM kanban view (make sure no record exist so the no_content message is displayed) - Add a new record - Fill in the name, click outside of the field The no_content message is displayed over the form view and it is impossible to save the record. The root cause is the incorrect structure of the kanban view page in RTL, leading the user to the wrong element and triggering the wrong event. We make the structure of the view aware of the RTL configuration. opw-2046231 closes odoo/odoo#35509 Signed-off-by: Nicolas Martinelli (nim) Co-authored-by: Mohammed Shekha --- .../web/static/tests/views/kanban_mobile_tests.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'addons/web/static/tests') diff --git a/addons/web/static/tests/views/kanban_mobile_tests.js b/addons/web/static/tests/views/kanban_mobile_tests.js index 0ee35c2c9c3..25d700b0d61 100644 --- a/addons/web/static/tests/views/kanban_mobile_tests.js +++ b/addons/web/static/tests/views/kanban_mobile_tests.js @@ -1,10 +1,12 @@ odoo.define('web.kanban_mobile_tests', function (require) { "use strict"; +var core = require('web.core'); var KanbanView = require('web.KanbanView'); var testUtils = require('web.test_utils'); var createView = testUtils.createView; +var _t = core._t; QUnit.module('Views', { beforeEach: function () { @@ -104,6 +106,35 @@ QUnit.module('Views', { kanban.destroy(); }); + + QUnit.test('mobile grouped rendering in rtl direction', function (assert) { + assert.expect(2); + + var direction = _t.database.parameters.direction; + _t.database.parameters.direction = 'rtl'; + + var kanban = createView({ + View: KanbanView, + model: 'partner', + data: this.data, + arch: '' + + '' + + '
' + + '
' + + '
', + domain: [['product_id', '!=', false]], + groupBy: ['product_id'], + }); + + assert.strictEqual(kanban.$('.o_kanban_group:first')[0].style.right, '0%', + "first tab should have 50% right"); + assert.strictEqual(kanban.$('.o_kanban_group:nth(1)')[0].style.right, '100%', + "second tab should have 100% right"); + + kanban.destroy(); + _t.database.parameters.direction = direction; + }); + QUnit.test('mobile grouped with undefined column', function (assert) { assert.expect(3); -- cgit v1.2.3 From cf318ad90c98a67b0e7d0d69839410463a7e189b Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 14 Aug 2019 09:29:10 +0000 Subject: [FIX] web: list: tweak columns weight --- addons/web/static/tests/views/list_tests.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'addons/web/static/tests') diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 58ea532eeb2..66be047c984 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -1387,10 +1387,10 @@ QUnit.module('Views', { QUnit.test('width of some of the fields should be hardcoded', async function (assert) { const assertions = [ { field: 'bar', expected: 40, type: 'Boolean' }, - { field: 'int_field', expected: 80, type: 'Integer' }, - { field: 'qux', expected: 100, type: 'Float' }, - { field: 'date', expected: 100, type: 'Date' }, - { field: 'datetime', expected: 150, type: 'Datetime' }, + { field: 'int_field', expected: 74, type: 'Integer' }, + { field: 'qux', expected: 92, type: 'Float' }, + { field: 'date', expected: 92, type: 'Date' }, + { field: 'datetime', expected: 146, type: 'Datetime' }, ]; assert.expect(assertions.length + 1); @@ -1452,9 +1452,8 @@ QUnit.module('Views', { }); // the width is hardcoded to make sure we have the same condition - // between debug mode and non debug mode (#qunit-fixture is limited to - // 1000px) - list.$el.width('1000px'); + // between debug mode and non debug mode + list.$el.width('1200px'); var startHeight = list.$('.o_data_row:first').height(); // start edition of first row -- cgit v1.2.3