diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-07-11 13:23:30 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-07-19 08:39:59 +0000 |
| commit | 4bfb8b4dcad50a9b4b8e452c19ae3d0f339d1af7 (patch) | |
| tree | a12f2c2cf51cf86d7e4b5f8d68cb826ee1ecc75a /addons/web/static/tests/views | |
| parent | 87f1d1c8a9f3f82a536fc849390d511bf1f6a96f (diff) | |
[IMP] web: searchpanel: keep scroll position
... when switching between controllers
Diffstat (limited to 'addons/web/static/tests/views')
| -rw-r--r-- | addons/web/static/tests/views/search_panel_tests.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/search_panel_tests.js b/addons/web/static/tests/views/search_panel_tests.js index a285c1df81b..0c4ec6fb7bb 100644 --- a/addons/web/static/tests/views/search_panel_tests.js +++ b/addons/web/static/tests/views/search_panel_tests.js @@ -2042,6 +2042,40 @@ QUnit.module('Views', { actionManager.destroy(); }); + QUnit.test('scroll position is kept when switching between controllers', async function (assert) { + assert.expect(6); + + for (var i = 10; i < 20; i++) { + this.data.category.records.push({id: i, name: "Cat " + i}); + } + + var actionManager = await createActionManager({ + actions: this.actions, + archs: this.archs, + data: this.data, + services: this.services, + }); + actionManager.$el.css('max-height', 300); + + await actionManager.doAction(1); + assert.containsOnce(actionManager, '.o_content .o_kanban_view'); + assert.strictEqual(actionManager.$('.o_search_panel').scrollTop(), 0); + + // simulate a scroll in the search panel and switch into list + actionManager.$('.o_search_panel').scrollTop(50); + await testUtils.dom.click(actionManager.$('.o_cp_switch_list')); + assert.containsOnce(actionManager, '.o_content .o_list_view'); + assert.strictEqual(actionManager.$('.o_search_panel').scrollTop(), 50); + + // simulate another scroll and switch back to kanban + actionManager.$('.o_search_panel').scrollTop(30); + await testUtils.dom.click(actionManager.$('.o_cp_switch_kanban')); + assert.containsOnce(actionManager, '.o_content .o_kanban_view'); + assert.strictEqual(actionManager.$('.o_search_panel').scrollTop(), 30); + + actionManager.destroy(); + }); + QUnit.test('search panel is not instanciated in dialogs', async function (assert) { assert.expect(2); |
