[MERGE] forward port branch saas-11.2 up to fed775bc0c
This commit is contained in:
@@ -1796,7 +1796,6 @@ QUnit.module('basic_fields', {
|
||||
assert.strictEqual(form.$('div[name="document"] > img').css('max-width'), "90px",
|
||||
"the image should correctly set its attributes");
|
||||
form.destroy();
|
||||
|
||||
});
|
||||
|
||||
QUnit.test('image fields in subviews are loaded correctly', function (assert) {
|
||||
@@ -1853,6 +1852,34 @@ QUnit.module('basic_fields', {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('image fields with required attribute', function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch: '<form string="Partners">' +
|
||||
'<field name="document" required="1" widget="image"/>' +
|
||||
'</form>',
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === 'create') {
|
||||
throw new Error("Should not do a create RPC with unset required image field");
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
|
||||
assert.ok(form.$('.o_form_view').hasClass('o_form_editable'),
|
||||
"form view should still be editable");
|
||||
assert.ok(form.$('.o_field_widget').hasClass('o_field_invalid'),
|
||||
"image field should be displayed as invalid");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('JournalDashboardGraph', {
|
||||
beforeEach: function () {
|
||||
_.extend(this.data.partner.fields, {
|
||||
|
||||
Reference in New Issue
Block a user