summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorRomeo Fragomeli <rfr@odoo.com>2020-10-08 08:20:25 +0000
committerRomeo Fragomeli <rfr@odoo.com>2020-12-08 12:04:36 +0000
commitc6c4b9f0e4bae03b51d232ea920de9587d8e2b73 (patch)
treefd4a269aeb0d74af1ec22ab7c24855b008d43a34 /addons/web/static/tests
parent52bf0e331fb9230423b76b9014bb13d490930e76 (diff)
[FIX] web: don't update the list view if not needed
Before this commit, an event was triggered even when no change occurred. Steps to reproduces: * Go to Document * Change to list view * Go to app switcher * Select another app that has enough content to be able to scroll * Scroll the view => Bug Task ID: 2347584 closes odoo/odoo#63012 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com> Co-authored-by: Michaël Mattiello <mcm@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/views/list_tests.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 29a3bcddbf4..81e95ddfabc 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -10871,6 +10871,52 @@ QUnit.module('Views', {
unpatchDate();
testUtils.mock.unpatch(BasicModel);
});
+
+ QUnit.test("update control panel while list view is mounting", async function (assert) {
+ const ControlPanel = require('web.ControlPanel');
+ const ListController = require('web.ListController');
+
+ let mountedCounterCall = 0;
+
+ ControlPanel.patch('test.ControlPanel', T => {
+ class ControlPanelPatchTest extends T {
+ mounted() {
+ mountedCounterCall = mountedCounterCall + 1;
+ assert.step(`mountedCounterCall-${mountedCounterCall}`);
+ super.mounted(...arguments);
+ }
+ }
+ return ControlPanelPatchTest;
+ });
+
+ const MyListView = ListView.extend({
+ config: Object.assign({}, ListView.prototype.config, {
+ Controller: ListController.extend({
+ async start() {
+ await this._super(...arguments);
+ this.renderer._updateSelection();
+ },
+ }),
+ }),
+ });
+
+ assert.expect(2);
+
+ const list = await createView({
+ View: MyListView,
+ model: 'event',
+ data: this.data,
+ arch: '<tree><field name="name"/></tree>',
+ });
+
+ assert.verifySteps([
+ 'mountedCounterCall-1',
+ ]);
+
+ ControlPanel.unpatch('test.ControlPanel');
+
+ list.destroy();
+ });
});
});