[IMP] web: list: display help in header cell tooltip

Task 2036832

closes odoo/odoo#34939

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
This commit is contained in:
Aaron Bohy
2019-07-17 10:10:09 +00:00
parent b311d9ccba
commit 363c6f1d90
2 changed files with 32 additions and 1 deletions
@@ -745,7 +745,7 @@ var ListRenderer = BasicRenderer.extend({
$th.css({ textAlign: 'right' });
}
if (config.isDebug()) {
if (config.isDebug() || node.attrs.help || field.help) {
var fieldDescr = {
field: field,
name: name,
@@ -6521,6 +6521,37 @@ QUnit.module('Views', {
list.destroy();
});
QUnit.test('always display field help as toolip of header cells', async function (assert) {
assert.expect(6);
this.data.foo.fields.foo.help = "This is Foo field";
var list = await createView({
View: ListView,
model: 'foo',
data: this.data,
arch: `<tree>
<field name="foo"/>
<field name="bar" help="This is Bar field"/>
</tree>`,
});
var $fooHeader = list.$('th[data-name=foo]');
$fooHeader.tooltip('show', true);
$fooHeader.trigger($.Event('mouseenter'));
assert.containsOnce(document.body, '.oe_tooltip_string');
assert.strictEqual($('.oe_tooltip_string').text().trim(), 'Foo');
assert.strictEqual($('.oe_tooltip_help').text().trim(), 'This is Foo field');
var $barHeader = list.$('th[data-name=bar]');
$barHeader.tooltip('show', true);
$barHeader.trigger($.Event('mouseenter'));
assert.containsOnce(document.body, '.oe_tooltip_string');
assert.strictEqual($('.oe_tooltip_string').text().trim(), 'Bar');
assert.strictEqual($('.oe_tooltip_help').text().trim(), 'This is Bar field');
list.destroy();
});
// TODO: write test on:
// - default_get with a field not in view
});