summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/form_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-06-05 09:18:14 +0000
committerAaron Bohy <aab@odoo.com>2020-06-12 09:47:48 +0000
commitb4ba0fc34082deec8ca6c871ce7a203c0a3a61a4 (patch)
tree27451423f32b218e699d3135c398d338b249c5cd /addons/web/static/tests/views/form_tests.js
parentdc260c324170a90fa737cd21dd528e39d658d9b6 (diff)
[FIX] *: adapt tests to env rework
This commit adapts tests following recent changes on the helpers. The main change is that addMockEnvironment (and all functions using it) are now async, as they need to wait for services to be started.
Diffstat (limited to 'addons/web/static/tests/views/form_tests.js')
-rw-r--r--addons/web/static/tests/views/form_tests.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js
index 33bc3de7347..56fba6515bc 100644
--- a/addons/web/static/tests/views/form_tests.js
+++ b/addons/web/static/tests/views/form_tests.js
@@ -7706,7 +7706,7 @@ QUnit.module('Views', {
});
QUnit.test('check if the view destroys all widgets and instances', async function (assert) {
- assert.expect(1);
+ assert.expect(2);
var instanceNumber = 0;
await testUtils.mock.patch(mixins.ParentedMixin, {
@@ -7766,21 +7766,10 @@ QUnit.module('Views', {
};
var form = await createView(params);
- form.destroy();
-
- var initialInstanceNumber = instanceNumber;
- instanceNumber = 0;
-
- form = await createView(params);
-
- // call destroy function of controller to ensure that it correctly destroys everything
- form.__destroy();
-
- // + 4 (parent)
- assert.strictEqual(instanceNumber, initialInstanceNumber + 1,
- "every widget must be destroyed exept the parent");
+ assert.ok(instanceNumber > 0);
form.destroy();
+ assert.strictEqual(instanceNumber, 0);
await testUtils.mock.unpatch(mixins.ParentedMixin);
});