diff options
| author | Sébastien Theys <seb@odoo.com> | 2018-08-21 16:13:33 +0200 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2018-08-22 11:51:30 +0200 |
| commit | 289adeb63f51a9af26b8f383ba80089aa7aa6d87 (patch) | |
| tree | 06b82d4b5949a305dddb3ae268de20631acbb648 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 4310b11df534daecbf3ca49b01bd6fbad42d499f (diff) | |
[FIX] web: properly resize textarea when its value changes
Before this commit, a textarea would not resize when its value changed if the event was different than "input" or "focus".
This commit fixes it by also listening to the "change" event, and by triggering it at appropriate times.
PR: #26430
Task: 1869469
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index e1da69fe9c5..3e545ad1681 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1487,6 +1487,42 @@ QUnit.module('basic_fields', { list.destroy(); }); + QUnit.test('text fields in edit mode should resize on reset', function (assert) { + assert.expect(1); + + this.data.partner.fields.foo.type = 'text'; + + this.data.partner.onchanges = { + bar: function (obj) { + obj.foo = 'a\nb\nc\nd\ne\nf'; + }, + }; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<field name="bar"/>' + + '<field name="foo"/>' + + '</form>', + res_id: 1, + }); + + // edit the form + // trigger a textarea reset (through onchange) by clicking the box + // then check there is no scroll bar + form.$buttons.find('.o_form_button_edit').click(); + + form.$('div[name="bar"] input').click(); + + var $textarea = form.$('textarea:first'); + assert.strictEqual($textarea.innerHeight(), $textarea[0].scrollHeight, + "textarea should not have a scroll bar"); + + form.destroy(); + }); + QUnit.test('text field translatable', function (assert) { assert.expect(3); |
