[MERGE] forward port branch saas-11.3 up to c0eef42711

This commit is contained in:
Christophe Simonis
2018-11-29 18:38:55 +01:00
35 changed files with 1318 additions and 473 deletions
@@ -5411,6 +5411,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: '<form>' +
'<field name="display_name" />' +
'<field name="qux" invisible="1" />' +
'<field name="int_field" widget="progressbar" options="{\'current_value\': \'int_field\', \'max_value\': \'qux\'}" />' +
'</form>',
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();
});
});
});
});