summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhruv Patel <dhp@odoo.com>2020-05-21 13:18:42 +0000
committerMathieu Duckerts-Antoine <dam@odoo.com>2020-08-18 12:26:08 +0000
commitc6b0876fa69c2dc4aeb79c2ad20b0056125cf9e4 (patch)
tree8d343ee160da5504ae2bd95770674b014ea5515d
parent452d7427cafbae5d0f40e82c0e43e07cbfee39f0 (diff)
[FIX] web: search panel: keep good active values
In saas-13.4, if a searchpanel_default_XXXX value was found in the context to be used as the default value of a searchpanel category (select="one" field), then the value shown to be active for that category would always be that value even if another value would have been selected at some point. This was due to the fact that the activeValueId was reset at each reload of the category to be that default value. In saas-13.5, the problem has been solved by 7ff2e5822f08616dd22c142e0e05ed4355801760. The present commit is simply the forward port of a test that covers the situation described above. closes odoo/odoo#56042 Task: 2259602 X-original-commit: bdf4fe44652668274030bb6fda25cb564f15c3a6 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
-rw-r--r--addons/web/static/tests/views/search_panel_tests.js28
1 files changed, 24 insertions, 4 deletions
diff --git a/addons/web/static/tests/views/search_panel_tests.js b/addons/web/static/tests/views/search_panel_tests.js
index 4a22ce8cb28..cf2cd4b49c6 100644
--- a/addons/web/static/tests/views/search_panel_tests.js
+++ b/addons/web/static/tests/views/search_panel_tests.js
@@ -305,10 +305,10 @@ QUnit.module('Views', {
kanban.destroy();
});
- QUnit.test('specify active category value in context', async function (assert) {
- assert.expect(1);
+ QUnit.test('specify active category value in context and manually change category', async function (assert) {
+ assert.expect(5);
- var kanban = await createView({
+ const kanban = await createView({
View: KanbanView,
model: 'partner',
data: this.data,
@@ -333,7 +333,7 @@ QUnit.module('Views', {
},
mockRPC: function (route, args) {
if (route === '/web/dataset/search_read') {
- assert.deepEqual(args.domain, [["state", "=", "ghi"]]);
+ assert.step(JSON.stringify(args.domain));
}
return this._super.apply(this, arguments);
},
@@ -343,6 +343,26 @@ QUnit.module('Views', {
},
});
+ assert.deepEqual(
+ [...kanban.el.querySelectorAll('.o_search_panel_category_value header.active label')].map(
+ el => el.innerText
+ ),
+ ['All', 'GHI']
+ );
+
+ // select 'ABC' in the category 'state'
+ await testUtils.dom.click(kanban.el.querySelectorAll('.o_search_panel_category_value header')[4]);
+ assert.deepEqual(
+ [...kanban.el.querySelectorAll('.o_search_panel_category_value header.active label')].map(
+ el => el.innerText
+ ),
+ ['All', 'ABC']
+ );
+
+ assert.verifySteps([
+ '[["state","=","ghi"]]',
+ '[["state","=","abc"]]'
+ ]);
kanban.destroy();
});