From c8d77f93e5a857acd22025f4a8d4d42d674479d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 8 May 2017 10:55:46 +0200 Subject: [FIX] web: display empty input fields properly Before this commit, it was not possible to see the difference between an unset float field (with a 'false' value) and a set field (for ex, with value 0) This was due to the fact that the formatFloat/formatMonetary functions format false values as the number 0, unlike many other formatting functions. --- addons/web/static/tests/fields/basic_fields_tests.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (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 f2334b61f4a..6e007949ea7 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -415,9 +415,9 @@ QUnit.module('basic_fields', { '', }); - var zeroValues = list.$('td').filter(function () {return $(this).text() === '0.000';}); - assert.strictEqual(zeroValues.length, 2, - 'Unset float values should be rendered as zeros.'); + var zeroValues = list.$('td.o_data_cell').filter(function () {return $(this).text() === '';}); + assert.strictEqual(zeroValues.length, 1, + 'Unset float values should be rendered as empty strings.'); // switch to edit mode var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first(); @@ -441,8 +441,8 @@ QUnit.module('basic_fields', { QUnit.test('do not trigger a field_changed if they have not changed', function (assert) { assert.expect(2); - this.data.partner.records[1].qux = undefined; - this.data.partner.records[1].int_field = undefined; + this.data.partner.records[1].qux = false; + this.data.partner.records[1].int_field = false; var form = createView({ View: FormView, model: 'partner', @@ -1659,9 +1659,9 @@ QUnit.module('basic_fields', { assert.strictEqual(euroValues.length, 1, 'One one line has euro as a currency.'); - var zeroValues = list.$('td').filter(function () {return _.str.include($(this).text(), '0.00');}); - assert.strictEqual(zeroValues.length, 2, - 'Unset float values should be rendered as zeros.'); + var zeroValues = list.$('td.o_data_cell').filter(function () {return $(this).text() === '';}); + assert.strictEqual(zeroValues.length, 1, + 'Unset float values should be rendered as empty strings.'); // switch to edit mode var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector):contains($)'); -- cgit v1.2.3