summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-11-23 13:32:19 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2018-11-26 14:51:09 +0000
commit889bdd356980843de238c85bac7f6538b903d493 (patch)
treeb5609e3a8b8c30deb21dcf2e47633e1dd02b3ae5 /addons/web/static/tests/fields/basic_fields_tests.js
parentb27c5e0c366cd914cf13bb47c78b4acd6808c3a4 (diff)
[FIX] web: fielddate[time] should select their value when entering them
Before this commit, when focusing on a date[time] field, the value was not selected In v11.0, it was This is due mostly because of the migration to BootStrap 4 After this commit, the value inside the input is selected OPW 1911333 closes odoo/odoo#28989
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js32
1 files changed, 32 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 eaa4a53e5db..22a852efa6b 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -2937,6 +2937,38 @@ QUnit.module('basic_fields', {
form.destroy();
});
+ QUnit.test('field date should select its content onclick when there is one', function (assert) {
+ assert.expect(2);
+ var done = assert.async();
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch:'<form string="Partners">' +
+ '<field name="display_name" /> ' + // Do not focus on the date field right away
+ '<field name="date" />' +
+ '</form>',
+ res_id: 1,
+ viewOptions: {
+ mode: 'edit',
+ },
+ });
+
+ form.$el.on({
+ 'show.datetimepicker': function () {
+ assert.ok($('.bootstrap-datetimepicker-widget').is(':visible'),
+ 'bootstrap-datetimepicker is visible');
+ assert.strictEqual(window.getSelection().toString(), "02/03/2017",
+ 'The whole input of the date field should have been selected');
+ done();
+ }
+ });
+ form.$('.o_input[name="date"]').mouseenter().trigger('focus');
+
+ form.destroy();
+ });
+
QUnit.module('FieldDatetime');
QUnit.test('datetime field in form view', function (assert) {