summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/control_panel_tests.js
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-06-14 15:38:44 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2019-06-17 07:49:06 +0000
commit800a55c06f70d36673defa808b2a943130e69c8f (patch)
tree923f2d3ef2d4417a9e6bfab6f0001732005320c4 /addons/web/static/tests/views/control_panel_tests.js
parentcaaaa129f752da7bcb541cc43a2303b6d32b1359 (diff)
[FIX] web: Favorites checkboxes are mutually exclusive
Before this commit, one could activate the two checkboxes "use by default", and "share for all users" After this commit, only one out of the two can be checked OPW 2010458 closes odoo/odoo#34167 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests/views/control_panel_tests.js')
-rw-r--r--addons/web/static/tests/views/control_panel_tests.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/control_panel_tests.js b/addons/web/static/tests/views/control_panel_tests.js
index f2654e55e1b..5c38c58ca45 100644
--- a/addons/web/static/tests/views/control_panel_tests.js
+++ b/addons/web/static/tests/views/control_panel_tests.js
@@ -416,6 +416,47 @@ QUnit.module('Views', {
controlPanel.destroy();
});
+ QUnit.test('Favorites Use by Default and Share are exclusive', async function (assert) {
+ assert.expect(11);
+ var controlPanel = await createControlPanel({
+ model: 'partner',
+ arch: "<search></search>",
+ data: this.data,
+ searchMenuTypes: ['favorite'],
+ });
+ testUtils.dom.click(controlPanel.$('.o_favorites_menu_button'));
+ testUtils.dom.click(controlPanel.$('button.o_add_favorite'));
+ var $checkboxes = controlPanel.$('input[type="checkbox"]');
+
+ assert.strictEqual($checkboxes.length, 2,
+ '2 checkboxes are present')
+
+ assert.notOk($checkboxes[0].checked, 'Start: None of the checkboxes are checked (1)');
+ assert.notOk($checkboxes[1].checked, 'Start: None of the checkboxes are checked (2)');
+
+ testUtils.dom.click($checkboxes.eq(0));
+ assert.ok($checkboxes[0].checked, 'The first checkbox is checked');
+ assert.notOk($checkboxes[1].checked, 'The second checkbox is not checked');
+
+ testUtils.dom.click($checkboxes.eq(1));
+ assert.notOk($checkboxes[0].checked,
+ 'Clicking on the second checkbox checks it, and unchecks the first (1)');
+ assert.ok($checkboxes[1].checked,
+ 'Clicking on the second checkbox checks it, and unchecks the first (2)');
+
+ testUtils.dom.click($checkboxes.eq(0));
+ assert.ok($checkboxes[0].checked,
+ 'Clicking on the first checkbox checks it, and unchecks the second (1)');
+ assert.notOk($checkboxes[1].checked,
+ 'Clicking on the first checkbox checks it, and unchecks the second (2)');
+
+ testUtils.dom.click($checkboxes.eq(0));
+ assert.notOk($checkboxes[0].checked, 'End: None of the checkboxes are checked (1)');
+ assert.notOk($checkboxes[1].checked, 'End: None of the checkboxes are checked (2)');
+
+ controlPanel.destroy();
+ });
+
QUnit.test('load filter', async function (assert) {
assert.expect(1);