diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 1ee50daaf65..23e59b2f03d 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -1327,7 +1327,7 @@ QUnit.module('ActionManager', { QUnit.module('Report actions'); QUnit.test('can execute report actions from db ID', function (assert) { - assert.expect(5); + assert.expect(6); var actionManager = createActionManager({ actions: this.actions, @@ -1358,6 +1358,7 @@ QUnit.module('ActionManager', { assert.verifySteps([ '/web/action/load', '/report/check_wkhtmltopdf', + '/web/static/src/img/spin.png', // block UI image '/report/download', 'on_close', ]); @@ -1366,7 +1367,7 @@ QUnit.module('ActionManager', { }); QUnit.test('should trigger a notification if wkhtmltopdf is to upgrade', function (assert) { - assert.expect(5); + assert.expect(6); var actionManager = createActionManager({ actions: this.actions, @@ -1398,6 +1399,7 @@ QUnit.module('ActionManager', { '/web/action/load', '/report/check_wkhtmltopdf', 'notification', + '/web/static/src/img/spin.png', // block UI image '/report/download', ]); diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 8488076b3f0..32a5c3c975e 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1666,7 +1666,7 @@ QUnit.module('basic_fields', { }); QUnit.test('image fields in subviews are loaded correctly', function (assert) { - assert.expect(5); + assert.expect(6); this.data.partner.records[0].__last_update = '2017-02-08 10:00:00'; this.data.partner.records[0].document = 'myimage'; @@ -1695,6 +1695,10 @@ QUnit.module('basic_fields', { assert.step("The view's image should have been fetched"); return $.when('wow'); } + if (route === 'data:image/png;base64,product_image') { + assert.step("The dialog's image should have been fetched"); + return $.when(); + } return this._super.apply(this, arguments); }, }); @@ -1707,9 +1711,10 @@ QUnit.module('basic_fields', { form.$('tbody td:contains(gold)').click(); assert.strictEqual($('.modal-dialog').length, 1, 'The modal should have opened'); - assert.strictEqual($('.modal-dialog').find('.o_field_image > img')[0].src, - 'data:image/png;base64,product_image', - 'The image of the many2many in its form view should be present'); + assert.verifySteps([ + "The view's image should have been fetched", + "The dialog's image should have been fetched", + ]); form.destroy(); }); diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 6b2c09d2631..f8c7bd6a22c 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -101,19 +101,12 @@ var createActionManager = function (params) { widget.appendTo($target); widget.$el.addClass('o_web_client'); - // make sure images and iframes do not trigger a GET on the server - // AAB; this should be done in addMockEnvironment - $target.on('DOMNodeInserted.removeSRC', function () { - removeSrcAttribute($(this), widget); - }); - var userContext = params.context && params.context.user_context || {}; var actionManager = new ActionManager(widget, userContext); var originalDestroy = ActionManager.prototype.destroy; actionManager.destroy = function () { actionManager.destroy = originalDestroy; - $target.off('DOMNodeInserted.removeSRC'); widget.destroy(); }; actionManager.appendTo(widget.$el); @@ -216,11 +209,6 @@ function createAsyncView(params) { var view = new params.View(viewInfo, viewOptions); - // make sure images do not trigger a GET on the server - $target.on('DOMNodeInserted.removeSRC', function () { - removeSrcAttribute($(this), widget); - }); - // reproduce the DOM environment of views var $web_client = $('