summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2019-02-26 16:37:13 +0000
committerMartin Geubelle <mge@odoo.com>2019-02-27 11:39:52 +0000
commite39bcae818847e9700299df60fd66edf5429c0e0 (patch)
treeea719683101133cb925cc054c29347defd19b60f /addons/web/static/tests/fields/relational_fields_tests.js
parent70c8fd7f759de9109eee2dd29f2573c5f60594e9 (diff)
[FIX] web: avoid crash when clicking on colored m2m in list
With the BS4 update, a traceback occured when clicking on a m2m tag using colors in a list view. When using colors on m2m tags, the badge was wrapped inside a `dropdown-toggle`. However, there is no `dropdown-menu` by default (it is only rendered in FormFieldMany2ManyTags when clicking on the `.dropdown-toggle`, hence the traceback. The `dropdown-toggle` class is now only set if necessary. Task 1925313 closes odoo/odoo#31445
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 316f5caeffd..640e02701c2 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -12683,6 +12683,30 @@ QUnit.module('relational_fields', {
form.destroy();
});
+ QUnit.test('fieldmany2many tags in tree view', function (assert) {
+ assert.expect(3);
+
+ this.data.partner.records[0].timmy = [12, 14];
+ var list = createView({
+ View: ListView,
+ model: 'partner',
+ data: this.data,
+ arch: '<tree string="Partners">' +
+ '<field name="timmy" widget="many2many_tags" options="{\'color_field\': \'color\'}"/>' +
+ '</tree>',
+ });
+ assert.containsN(list, '.o_field_many2manytags .badge', 2, "there should be 2 tags");
+ assert.containsNone(list, '.dropdown-toggle', "the tags should not be dropdowns");
+
+ testUtils.intercept(list, 'switch_view', function (event) {
+ assert.strictEqual(event.data.view_type, "form", "should switch to form view");
+ });
+ // click on the tag: should do nothing and open the form view
+ testUtils.dom.click(list.$('.o_field_many2manytags .badge:first'));
+
+ list.destroy();
+ });
+
QUnit.test('fieldmany2many tags view a domain', function (assert) {
assert.expect(7);