diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-04-18 18:20:40 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-04-18 18:20:40 +0200 |
| commit | fed775bc0c2d70463206bbdddd3cce9ae8469e6a (patch) | |
| tree | 03fd8410a57a49c39658f1ba184e29ccef5b3291 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 4d2e22bc392f27d920542e6ca025273080e5df77 (diff) | |
| parent | 8c64159b8847dc465a21415c085d6526d280be02 (diff) | |
[MERGE] forward port branch 11.0 up to 8c64159b884
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 29 |
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 f321db1d172..08b7826b4c8 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1736,7 +1736,6 @@ QUnit.module('basic_fields', { assert.strictEqual(form.$('div[name="document"] > img').attr('width'), "90", "the image should correctly set its attributes"); form.destroy(); - }); QUnit.test('image fields in subviews are loaded correctly', function (assert) { @@ -1788,6 +1787,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, { |
