diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 924659be0f7..82607c43689 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -1564,7 +1564,7 @@ QUnit.module('Views', { '', }); - assert.containsNone(list, 'o_resize', "There shouldn't be any resize handle if no data"); + assert.containsNone(list, '.o_resize', "There shouldn't be any resize handle if no data"); assertions.forEach(a => { assert.strictEqual(list.$(`th[data-name="${a.field}"]`)[0].offsetWidth, a.expected, `Field ${a.type} should have a fixed width of ${a.expected} pixels`); @@ -1575,6 +1575,66 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('width of some fields should be hardcoded if no data, and list initially invisible', async function (assert) { + const assertions = [ + { field: 'bar', expected: 40, type: 'Boolean' }, + { 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' }, + { field: 'amount', expected: 104, type: 'Monetary' }, + { field: 'the_button', expected: 25, type: 'with custom width' }, + ]; + assert.expect(11); + + this.data.foo.fields.foo_o2m = {string: "Foo O2M", type: "one2many", relation: "foo"}; + const form = await createView({ + View: FormView, + model: 'foo', + data: this.data, + res_id: 1, + viewOptions: { mode: 'edit' }, + arch: `
+ + + + + + + + + + + + + +