summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-19 11:58:44 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-19 11:58:44 +0200
commite56be854abd87a57dd1f6c131328ebd572d62a26 (patch)
tree17300ce55eb8304dedfd348b968481450bc66fc6 /addons/web/static/tests/fields/basic_fields_tests.js
parent54ae09b100921041d60f61bee7f3a73280a79e35 (diff)
parent204935119d17096978958c09d1389fb4c36deec0 (diff)
[MERGE] forward port branch saas-11.3 up to 204935119d1
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 3a66a1dc701..9cda103eedd 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -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, {