From 75f7ab0608bfb9770e99fe2ce1ad55e76c70ac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Debauche=20St=C3=A9phane?= Date: Mon, 20 Jan 2020 14:28:35 +0000 Subject: [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 --- .../web/static/tests/fields/basic_fields_tests.js | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') 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: '
' + + '' + + '' + + '' + + '' + + '' + + '
', + 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'); -- cgit v1.2.3