[MERGE] forward port branch saas-11.2 up to 90f8f17fb4

This commit is contained in:
Christophe Simonis
2018-04-16 19:50:50 +02:00
1146 changed files with 204707 additions and 210894 deletions
@@ -2365,6 +2365,38 @@ QUnit.module('basic_fields', {
form.destroy();
});
QUnit.test('datetime field in form view', function (assert) {
assert.expect(1);
this.data.partner.fields.datetime.default = "2017-08-02 12:00:05";
this.data.partner.fields.datetime.required = true;
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch:'<form string="Partners"><field name="datetime"/></form>',
res_id: 1,
translateParameters: { // Avoid issues due to localization formats
date_format: '%m/%d/%Y',
time_format: '%H:%M',
},
});
testUtils.patch(basicFields.FieldDate, {
_setValue: function () {
throw "The time format of the language must be taken into account."
return this._super.apply(this, arguments);
},
});
form.$buttons.find('.o_form_button_create').click();
var expectedDateString = "08/02/2017 12:00"; // 10:00:00 without timezone
assert.strictEqual(form.$('.o_field_date input').val(), expectedDateString,
'the datetime should be correctly displayed in readonly');
testUtils.unpatch(basicFields.FieldDate);
form.destroy();
});
QUnit.test('datetime field in editable list view', function (assert) {
assert.expect(8);
@@ -3113,7 +3145,7 @@ QUnit.module('basic_fields', {
QUnit.module('PhoneWidget');
QUnit.test('phone field in form view on extra small screens', function (assert) {
assert.expect(7);
assert.expect(8);
var form = createView({
View: FormView,
@@ -3160,6 +3192,15 @@ QUnit.module('basic_fields', {
assert.strictEqual($phoneLink.attr('href'), 'tel:new',
"should still have proper tel prefix");
// NOT NEEDED AS OF SAAS-11.3
// save phone with &shy; and verify it is removed
form.$buttons.find('.o_form_button_edit').click();
form.$('input[type="text"].o_field_widget').val('h\u00ADi').trigger('input');
form.$buttons.find('.o_form_button_save').click();
$phoneLink = form.$('a.o_form_uri.o_field_widget');
assert.strictEqual($phoneLink.attr('href'), 'tel:hi',
"U+00AD should have been removed");
form.destroy();
});