diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 4d8be05d252..f6bd08e9278 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -716,7 +716,7 @@ var ListRenderer = BasicRenderer.extend({ name: name, string: description || name, record: this.state, - attrs: node.attrs, + attrs: _.extend({}, node.attrs, this.state.fieldsInfo.list[name]), }; this._addFieldTooltip(fieldDescr, $th); } else { diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 93fb7c0fb68..6120aaee3da 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -1678,7 +1678,7 @@ QUnit.module('Views', { }); QUnit.test('display a tooltip on a field', async function (assert) { - assert.expect(2); + assert.expect(4); var initialDebugMode = config.debug; config.debug = false; @@ -1687,24 +1687,34 @@ QUnit.module('Views', { View: ListView, model: 'foo', data: this.data, - arch: '', + arch: '' + + '' + + '' + + '', }); // this is done to force the tooltip to show immediately instead of waiting // 1000 ms. not totally academic, but a short test suite is easier to sell :( - list.$('th:not(.o_list_record_selector)').tooltip('show', false); + list.$('th[data-name=foo]').tooltip('show', false); - list.$('th:not(.o_list_record_selector)').trigger($.Event('mouseenter')); + list.$('th[data-name=foo]').trigger($.Event('mouseenter')); assert.strictEqual($('.tooltip .oe_tooltip_string').length, 0, "should not have rendered a tooltip"); config.debug = true; // it is necessary to rerender the list so tooltips can be properly created await list.reload(); - list.$('th:not(.o_list_record_selector)').tooltip('show', false); - - list.$('th:not(.o_list_record_selector)').trigger($.Event('mouseenter')); + list.$('th[data-name=foo]').tooltip('show', false); + list.$('th[data-name=foo]').trigger($.Event('mouseenter')); assert.strictEqual($('.tooltip .oe_tooltip_string').length, 1, "should have rendered a tooltip"); + await list.reload(); + list.$('th[data-name=bar]').tooltip('show', false); + list.$('th[data-name=bar]').trigger($.Event('mouseenter')); + assert.containsOnce($, '.oe_tooltip_technical>li[data-item="widget"]', + 'widget should be present for this field'); + assert.strictEqual($('.oe_tooltip_technical>li[data-item="widget"]')[0].lastChild.wholeText.trim(), + 'Button (toggle_button)', "widget description should be correct"); + config.debug = initialDebugMode; list.destroy(); });