From 889bdd356980843de238c85bac7f6538b903d493 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 23 Nov 2018 13:32:19 +0000 Subject: [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 --- .../web/static/tests/fields/basic_fields_tests.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') 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:'
' + + ' ' + // Do not focus on the date field right away + '' + + '', + 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) { -- cgit v1.2.3 From 23313583b2b111610abb1940034859b07282f33b Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 26 Nov 2018 12:54:39 +0000 Subject: [FIX] web: progressbar updates on field reset Have a form record with a progress bar Modify the max_value of the progress, as well as the current_value bar through an onchange Before this commit, the new max_value was not taken into account After this commit, it is. closes odoo/odoo#29056 --- .../web/static/tests/fields/basic_fields_tests.js | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 2fbc09a5622..d08f898dba1 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -4737,6 +4737,48 @@ QUnit.module('basic_fields', { form.destroy(); }); + + QUnit.module('FieldProgressBar'); + + QUnit.test('Field ProgressBar: max_value should update', function (assert) { + assert.expect(2); + + this.data.partner.records = this.data.partner.records.slice(0,1); + this.data.partner.records[0].qux = 2; + + this.data.partner.onchanges = { + display_name: function (obj) { + obj.int_field = 999; + obj.qux = 5; + } + }; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
' + + '' + + '' + + '' + + '', + res_id: 1, + viewOptions: { + mode: 'edit', + }, + }); + + assert.strictEqual(form.$('.o_progressbar_value').text(), '10 / 2', + 'The initial value of the progress bar should be correct'); + + // trigger the onchange + form.$('.o_input[name=display_name]').val('new name').trigger('input'); + + assert.strictEqual(form.$('.o_progressbar_value').text(), '999 / 5', + 'The value of the progress bar should be correct after the update'); + + form.destroy(); + }); }); }); }); -- cgit v1.2.3