diff options
| author | Christophe Matthieu <chm@odoo.com> | 2017-04-26 16:12:25 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-04-28 11:32:05 +0200 |
| commit | 340baef44a66a90b70688e62303ec6f2b85f3d61 (patch) | |
| tree | 3f9ab0c4b07f58502cb1cdd7ba5d1f6e0dbacfb5 /addons/web/static/tests/fields/special_fields.js | |
| parent | e7a11878aa6430261358a3b2a1906398a2d3b852 (diff) | |
[FIX] web: FieldTimezoneMismatch does not work
The FieldTimezoneMismatch was redone, but an error was done after the
last code review. With this commit, we fix the mistake (a function is
properly called) and improve the test to make sure we catch such a
regression later.
Diffstat (limited to 'addons/web/static/tests/fields/special_fields.js')
| -rw-r--r-- | addons/web/static/tests/fields/special_fields.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/special_fields.js b/addons/web/static/tests/fields/special_fields.js index 3b16d0a0a62..af725a007f1 100644 --- a/addons/web/static/tests/fields/special_fields.js +++ b/addons/web/static/tests/fields/special_fields.js @@ -141,17 +141,25 @@ QUnit.module('special_fields', { QUnit.module('FieldTimezoneMismatch'); QUnit.test('widget timezone_mismatch in a list view', function (assert) { - assert.expect(3); + assert.expect(5); + this.data.partner.fields.tz_offset = {string: "tz_offset", type: "integer"}; this.data.partner.records.forEach(function (r) { r.color = 'red'; + r.tz_offset = 0; }); + this.data.partner.onchanges = { + color: function (r) { + r.tz_offset = '+4800'; // make sur we have a mismatch + } + }; var list = createView({ View: ListView, model: 'partner', data: this.data, arch: '<tree string="Colors" editable="top">' + + '<field name="tz_offset" invisible="True"/>' + '<field name="color" widget="timezone_mismatch"/>' + '</tree>', }); @@ -164,6 +172,11 @@ QUnit.module('special_fields', { assert.strictEqual($td.find('select').length, 1, "td should have a child 'select'"); assert.strictEqual($td.contents().length, 1, "select tag should be only child of td"); + + $td.find('select').val('"black"').trigger('change'); + + assert.strictEqual($td.find('.o_tz_warning').length, 1, "Should display icon alert"); + assert.ok($td.find('select option:selected').text().match(/Black\s+\([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+:[0-9]+\)/), "Should display the datetime in the selected timezone"); list.destroy(); }); |
