diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-05-12 08:41:23 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-05-12 13:43:39 +0000 |
| commit | e02a4b93e514e5b8ef457ea651e28ed84340bfeb (patch) | |
| tree | 6daf260e6301179b37dce6bda05ec52dc5dd4f98 /addons/web/static/src/js/fields/special_fields.js | |
| parent | 5d55426eb95c2258ab6ee6700866ef5825afb412 (diff) | |
[IMP] web: add more accurate test on onchange scenario
In a form view, have an x2many list with two fields A and B (e.g.
A is a many2one, and B is a char). There is an onchange on the
x2many that is triggered when the user sets A, and that sets B.
In this scenario, let's assume that the user first writes something
in B, but directly deletes it. Then, he sets A. In this situation,
B isn't updated with the value returned by the onchange.
Commit [1] is an attempt to fix this, but it actually broke what
has been done in [2]. However, tests of [2] still passed, because
they didn't accurately reproduce what happens in practice (outside
the test environment).
An input field widget listens to 'input' and 'change' events. It
commits its value when both occur, but in the 'input' case, the
action is debounced with a large value (so that it actually only
commits the value on 'change', i.e. when the field is focusset
out). In the tests, the debounce value is 0, so fields actually
commit their value directly when 'input' events occur. This is
something we may want to change in the future, to remove this
discrepancy.
This commit adds a test with a large debounce value, so that we
accurately test what happens in practice, and we make sure that
this won't be broken in an attempt of fixing something else.
[1] cdca11db2ec207363df1d4fb3c87014d9c931d25
[2] a71f22370217d2da6ad13bd29c2fa412a40ebe4c
Related to task 1958793
Diffstat (limited to 'addons/web/static/src/js/fields/special_fields.js')
0 files changed, 0 insertions, 0 deletions
