diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-08-22 07:06:18 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-08-23 06:28:35 +0000 |
| commit | e35c5e044e8280616d9dc0255f79ba2bba46c2eb (patch) | |
| tree | 7bbc664ec3b8d2cd22ed58b9c3cef913ceac6a1c /addons/web/static/tests | |
| parent | f00f7bf00d59fe003584734a1e93d5982f54cb9f (diff) | |
[FIX] web: editable list: force min-width to some columns
Columns with an absolute width (e.g. '120px') must always have a
width of at least that value. When there are records in the list
the column's widths are computed by the browser according to the
content (in readonly). However, for some field types, the rendering
in edition is a bit wider (e.g. date(time) fields because of the
caret).
This rev. sets a min-width to those fields such that the rendering
is also correct in edition.
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/list_tests.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index fa78f98ee23..05791ad9d74 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -1605,6 +1605,32 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('columns with an absolute width are never narrower than that width', async function (assert) { + assert.expect(2); + + this.data.foo.records[0].text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, ' + + 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim ' + + 'veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo ' + + 'consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum ' + + 'dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, ' + + 'sunt in culpa qui officia deserunt mollit anim id est laborum'; + var list = await createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '<tree editable="bottom">' + + '<field name="datetime"/>' + + '<field name="int_field" width="200px"/>' + + '<field name="text"/>' + + '</tree>', + }); + + assert.strictEqual(list.$('th[data-name="datetime"]')[0].offsetWidth, 146); + assert.strictEqual(list.$('th[data-name="int_field"]')[0].offsetWidth, 200); + + list.destroy(); + }); + QUnit.test('column widths are kept when editing multiple records', async function (assert) { assert.expect(4); |
