diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-02-08 14:43:14 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-02-12 11:13:42 +0100 |
| commit | 5c67abd0d306f446af9df59cb6bca2428f17f7a9 (patch) | |
| tree | b31d3c4cabe945286001815f3d29c64473d263be /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 107b82f6e13840c218706d55e434071fb2f2ed28 (diff) | |
[REF] web: tests: move calls to removeSrcAttribute
In the tests environment, we listen to the 'DOMNodeInserted' event
to remove the src attribute of img and iframe nodes as soon as they
are inserted into the DOM, so that they don't perform RPCs.
However, this listener was bound in the create(Async)View, and
createActionManager helpers only. This rev. moves it to the
addMockEnvironment helper which is more global, and basically used
by all tests.
Moreover, we now listen to the 'DOMNodeInserted' event on the body,
instead of on the widget, as it may happen that some content is
inserted into the DOM outside the widget itself (e.g. dialogs are
appended to the body).
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 13 |
1 files changed, 9 insertions, 4 deletions
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(); }); |
