diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-09-15 12:35:48 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-09-15 15:01:51 +0000 |
| commit | 8edfe6b32f779d8f0428e7be7a335fdfa7e44a89 (patch) | |
| tree | 8e307feeb8f4fedb5e16d8142d7054c29228c8bd /addons/web/static/tests | |
| parent | d2901cfbf6ad5b357a414293a954d906f425fa3a (diff) | |
[FIX] web: list: call mounted on subcomponents at reload
Issue was spotted in list views containing the "badge" widget with
decorations (e.g. in the Purchase Order list view). At first, the
decorations were correctly applied, but they weren't anymore after
a reload (e.g. after toggling a filter).
They weren't because the list renderer didn't called
'on_attach_callback' on its subwidgets at reload (thus, 'mounted'
wasn't called on its subcomponents, and the decorations are applied
in the mounted hook).
This commit moves the logic from the FormRenderer to the
BasicRenderer, so that it applies on List, Kanban, and Form views.
This commit also removes the transition scss rule on the badge
field widget as it caused a flickering at reload.
Task 2336440
closes odoo/odoo#57762
X-original-commit: 713bce22e8f412f2c26e663b9e30fdd64933ff0c
Signed-off-by: Michaƫl Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 8 | ||||
| -rw-r--r-- | addons/web/static/tests/views/list_tests.js | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 8debec81b3a..65df3a5af19 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -7606,7 +7606,7 @@ QUnit.module('basic_fields', { }); QUnit.test('FieldBadge component with decoration-xxx attributes', async function (assert) { - assert.expect(3); + assert.expect(6); const list = await createView({ View: ListView, @@ -7623,6 +7623,12 @@ QUnit.module('basic_fields', { assert.containsOnce(list, '.o_field_badge[name="foo"].bg-danger-light'); assert.containsOnce(list, '.o_field_badge[name="foo"].bg-warning-light'); + await list.reload(); + + assert.containsN(list, '.o_field_badge[name="foo"]', 5); + assert.containsOnce(list, '.o_field_badge[name="foo"].bg-danger-light'); + assert.containsOnce(list, '.o_field_badge[name="foo"].bg-warning-light'); + list.destroy(); }); }); diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 2ea2e0396a9..900375d0b59 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -10618,7 +10618,7 @@ QUnit.module('Views', { QUnit.test('list view with field component: mounted and willUnmount calls', async function (assert) { // this test could be removed as soon as the list view will be written in Owl - assert.expect(3); + assert.expect(7); let mountedCalls = 0; let willUnmountCalls = 0; @@ -10641,10 +10641,16 @@ QUnit.module('Views', { }); assert.containsN(list, '.o_data_row', 4); - list.destroy(); - assert.strictEqual(mountedCalls, 4); + assert.strictEqual(willUnmountCalls, 0); + + await list.reload(); + assert.strictEqual(mountedCalls, 8); assert.strictEqual(willUnmountCalls, 4); + + list.destroy(); + assert.strictEqual(mountedCalls, 8); + assert.strictEqual(willUnmountCalls, 8); }); QUnit.test('editable list view: multi edition of owl field component', async function (assert) { |
