diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-05-08 10:55:46 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-05-08 13:56:18 +0200 |
| commit | c8d77f93e5a857acd22025f4a8d4d42d674479d1 (patch) | |
| tree | 1591b578e28a64b929cf3aa3c9da7eea1cc93f49 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | aeae2fb64f16bbcf910d37b194f11e189febcae9 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 16 |
1 files changed, 8 insertions, 8 deletions
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', { '</tree>', }); - 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($)'); |
