summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2019-05-14 12:18:19 +0000
committerGoffin Simon <sig@odoo.com>2019-05-15 06:36:08 +0000
commit9ed9710b2b9ad685f4f09e42930e212d3cec71e5 (patch)
treebf8cf34b5761198764c100a22aa4eb9d8c299e22 /addons/web/static/tests/fields/basic_fields_tests.js
parentc3a81c6c7eebe1c2a42d01ac35f541cefd2c8f0d (diff)
[FIX] web: Error on invalid date format on date field input
Steps to reproduce the bug: - Go to any field Date - Enter wrong date Bug: A traceback was raised. Now a warning is raised and the wrong value is removed. opw:1974747 closes odoo/odoo#33362 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js19
1 files changed, 19 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 40593480099..1ae3439ade7 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -2667,6 +2667,25 @@ QUnit.module('basic_fields', {
form.destroy();
});
+ QUnit.test('date field should remove the date if the date is not valid', function (assert) {
+ assert.expect(1);
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form string="Partners"><field name="date"/></form>',
+ res_id: 4,
+ });
+ // switch to edit mode
+ form.$buttons.find('.o_form_button_edit').click();
+ // set an invalid date
+ var $input = form.$('.o_field_widget[name=date] input');
+ $input.val('mmmh').trigger('change');
+ assert.strictEqual($input.text(), "", "The date field should be empty");
+ form.destroy();
+ });
+
QUnit.test('date field value should not set on first click', function (assert) {
assert.expect(2);