summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/upgrade_fields_tests.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-09-15 14:18:57 +0200
committerMartin Geubelle <mge@odoo.com>2017-09-15 16:36:40 +0200
commitcb540c48eb575902018da97f2f541a813bda4d6b (patch)
tree3a0fff1ed0f2ece5cc960028e0fc34182c74e486 /addons/web/static/tests/fields/upgrade_fields_tests.js
parentae7f4c0485590623f2cd66cfa4aeb6b5c931047c (diff)
[FIX] web: correctly display the enterprise label
The `upgrade_boolean` widget should display an `Enterprise` label next to it. There is however an issue when a `label` is specified for this field. In this case, the `Enterprise` label should be placed next to the field label (and not the field itself). The easiest solution would have been to instantiate the field widget with its label, but this can't work because the field widget is instantiated before its label. We thus re-render the widget after its label creation.
Diffstat (limited to 'addons/web/static/tests/fields/upgrade_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/upgrade_fields_tests.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/fields/upgrade_fields_tests.js
index babc32b60a8..427ec7b54e3 100644
--- a/addons/web/static/tests/fields/upgrade_fields_tests.js
+++ b/addons/web/static/tests/fields/upgrade_fields_tests.js
@@ -39,6 +39,28 @@ QUnit.module('upgrade_fields', {
form.destroy();
});
+ QUnit.test('widget upgrade_boolean in a form view', function (assert) {
+ assert.expect(3);
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form>' +
+ '<div class="o_field"><field name="bar" widget="upgrade_boolean"/></div>' +
+ '<div class="o_label"><label for="bar"/><div>Coucou</div></div>' +
+ '</form>',
+ });
+
+ assert.strictEqual(form.$('.o_field .label').length, 0,
+ "the upgrade label shouldn't be inside the field section");
+ assert.strictEqual(form.$('.o_label .label').length, 1,
+ "the upgrade label should be inside the label section");
+ assert.strictEqual(form.$('.o_label').text(), "Bar EnterpriseCoucou",
+ "the upgrade label should be inside the label section");
+ form.destroy();
+ });
+
});
});
});