diff options
| author | Debauche Stéphane <std@odoo.com> | 2020-01-20 14:28:35 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-01-28 09:14:43 +0000 |
| commit | 75f7ab0608bfb9770e99fe2ce1ad55e76c70ac72 (patch) | |
| tree | 16654596a1fc75b24e71c56f56d27a65b96f5739 /addons/web/static/tests/fields | |
| parent | 1ec887b773581b6316902997fec94176bbae1ac0 (diff) | |
[FIX] web: fix email and phone widgets with empty value
When the value is empty in a related field, string of the element was
displaying "false" instead of an empty string which is not what we expect.
This commit fixes that issue.
Task ID 2119333
PR #40949
Diffstat (limited to 'addons/web/static/tests/fields')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 21e8ef25159..ede054eb5a9 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -31,6 +31,7 @@ QUnit.module('basic_fields', { display_name: {string: "Displayed name", type: "char", searchable: true}, foo: {string: "Foo", type: "char", default: "My little Foo Value", searchable: true, trim: true}, bar: {string: "Bar", type: "boolean", default: true, searchable: true}, + empty_string: {string: "Empty string", type: "char", default: false, searchable: true, trim: true}, txt: {string: "txt", type: "text", default: "My little txt Value\nHo-ho-hoooo Merry Christmas"}, int_field: {string: "int_field", type: "integer", sortable: true, searchable: true}, qux: {string: "Qux", type: "float", digits: [16,1], searchable: true}, @@ -996,6 +997,30 @@ QUnit.module('basic_fields', { list.destroy(); }); + QUnit.test('email field with empty value', async function (assert) { + assert.expect(1); + + var form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<sheet>' + + '<group>' + + '<field name="empty_string" widget="email"/>' + + '</group>' + + '</sheet>' + + '</form>', + res_id: 1, + }); + + var $mailtoLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow'); + assert.strictEqual($mailtoLink.text(), '', + "the value should be displayed properly"); + + form.destroy(); + }); + QUnit.module('FieldChar'); |
