diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-23 12:11:32 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-23 12:11:32 +0100 |
| commit | 7a0243ec15d916102ec4502db01ae5e70d6912cd (patch) | |
| tree | 29c940dcab4e9f7c834b8a5e899e394d8f821794 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 75477052a03530df791348cdcf819f5bedd46284 (diff) | |
| parent | b3052b690fad15feb3211525666d4962bc1a24ac (diff) | |
[MERGE] forward port branch 12.0 up to b3052b690fa
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 36 |
1 files changed, 36 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 b4998b01712..807b2ebadca 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -2773,6 +2773,42 @@ QUnit.module('basic_fields', { form.destroy(); }); + QUnit.test('date field with warn_future option: do not overwrite datepicker option', function (assert) { + assert.expect(2); + + // Making sure we don't have a legit default value + // or any onchange that would set the value + this.data.partner.fields.date.default = undefined; + this.data.partner.onchanges = {}; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form string="Partners">' + + '<field name="foo" />' + // Do not let the date field get the focus in the first place + '<field name="date" options="{\'datepicker\': {\'warn_future\': true}}"/>' + + '</form>', + res_id: 1, + }); + + // switch to edit mode + form.$buttons.find('.o_form_button_edit').click(); + assert.strictEqual(form.$('input[name="date"]').val(), '02/03/2017', + 'The existing record should have a value for the date field'); + + // save with no changes + form.$buttons.find('.o_form_button_save').click(); + + //Create a new record + form.$buttons.find('.o_form_button_create').click(); + + assert.notOk(form.$('input[name="date"]').val(), + 'The new record should not have a value that the framework would have set'); + + form.destroy(); + }); + QUnit.test('date field in editable list view', function (assert) { assert.expect(8); |
