diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-08-13 20:54:48 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-08-13 20:54:51 +0200 |
| commit | 9916e5bad3ed5eb77d2dadaa1d06949ec3b02347 (patch) | |
| tree | b6eee708b70fbaacc1bc057770cc86d9d60f9826 /addons/mail/static/tests/models/cc_throttle_function_tests.js | |
| parent | 732702d5e2a007797e589dc42b29f31a9e27c54f (diff) | |
[FIX] mail:tests: destroy mocked environment on qunit test end
Before this commit, some tests had created mocked environments without
destroying the parent widget. As a result, following tests may crash.
Diffstat (limited to 'addons/mail/static/tests/models/cc_throttle_function_tests.js')
| -rw-r--r-- | addons/mail/static/tests/models/cc_throttle_function_tests.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/addons/mail/static/tests/models/cc_throttle_function_tests.js b/addons/mail/static/tests/models/cc_throttle_function_tests.js index 6f74dcfe8d2..f5deb6c1f3c 100644 --- a/addons/mail/static/tests/models/cc_throttle_function_tests.js +++ b/addons/mail/static/tests/models/cc_throttle_function_tests.js @@ -5,7 +5,6 @@ var CCThrottleFunction = require('mail.model.CCThrottleFunction'); var CCThrottleFunctionObject = require('mail.model.CCThrottleFunctionObject'); var testUtils = require('web.test_utils'); -var Widget = require('web.Widget'); QUnit.module('mail', { beforeEach: function () { @@ -40,8 +39,7 @@ QUnit.test('cancel()', function (assert) { var def = $.Deferred(); var step = 1; - var widget = new Widget(); - testUtils.addMockEnvironment(widget, { + var widget = testUtils.createParent({ mockRPC: function (route, args) { if (args.method === '__rpc__') { assert.step(args.method + args.args[0]); @@ -84,6 +82,7 @@ QUnit.test('cancel()', function (assert) { this.timeoutCDDef.then(function () { assert.verifySteps(['__rpc__1'], "function should still have been called once after 2nd function call cancelled"); + widget.destroy(); done(); }); }); @@ -97,8 +96,7 @@ QUnit.test('clear()', function (assert) { var def2 = $.Deferred(); var step = 1; - var widget = new Widget(); - testUtils.addMockEnvironment(widget, { + var widget = testUtils.createParent({ mockRPC: function (route, args) { if (args.method === '__rpc__') { assert.step(args.method + args.args[0]); @@ -146,6 +144,7 @@ QUnit.test('clear()', function (assert) { $.when(self.timeoutCDDef, def2).then(function () { assert.verifySteps(['__rpc__1', '__rpc__2'], "function should have been called twice after 'clear' (buffered 2nd function call)"); + widget.destroy(); done(); }); }); |
