diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-02-26 16:39:30 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-02-26 16:39:30 +0100 |
| commit | ff9c9341d6ed4e9ab18a0aa02e79441999d658f1 (patch) | |
| tree | 47ffd01e071d3783cff6013cfc4b6c3d8e47a841 /addons/web/static/tests/core/widget_tests.js | |
| parent | bc84fdf71b15ad419f8693861aea682ee751f85c (diff) | |
| parent | fcb972db9dc778eeaf7d6b6ba3638c78d93998ad (diff) | |
[MERGE] forward port branch saas-12.2 up to fcb972db9dc
Diffstat (limited to 'addons/web/static/tests/core/widget_tests.js')
| -rw-r--r-- | addons/web/static/tests/core/widget_tests.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/addons/web/static/tests/core/widget_tests.js b/addons/web/static/tests/core/widget_tests.js index 834033a1769..0eb4192c4a1 100644 --- a/addons/web/static/tests/core/widget_tests.js +++ b/addons/web/static/tests/core/widget_tests.js @@ -24,6 +24,7 @@ QUnit.module('core', {}, function () { var fn = w.proxy('exec'); fn(); assert.ok(w.executed, 'should execute the named method in the right context'); + w.destroy(); }); QUnit.test('proxy (String)(*args)', function (assert) { @@ -39,6 +40,7 @@ QUnit.module('core', {}, function () { fn(42); assert.ok(w.executed, "should execute the named method in the right context"); assert.strictEqual(w.executed, 42, "should be passed the proxy's arguments"); + w.destroy(); }); QUnit.test('proxy (String), include', function (assert) { @@ -59,6 +61,7 @@ QUnit.module('core', {}, function () { fn(); assert.strictEqual(w.executed, 2, "should be lazily resolved"); + w.destroy(); }); QUnit.test('proxy (Function)', function (assert) { @@ -69,6 +72,7 @@ QUnit.module('core', {}, function () { var fn = w.proxy(function () { this.executed = true; }); fn(); assert.ok(w.executed, "should set the function's context (like Function#bind)"); + w.destroy(); }); QUnit.test('proxy (Function)(*args)', function (assert) { @@ -79,6 +83,7 @@ QUnit.module('core', {}, function () { var fn = w.proxy(function (arg) { this.executed = arg; }); fn(42); assert.strictEqual(w.executed, 42, "should be passed the proxy's arguments"); + w.destroy(); }); @@ -99,6 +104,7 @@ QUnit.module('core', {}, function () { assert.strictEqual(widget.el.nodeName, 'DIV', "should have generated the default element"); assert.strictEqual(widget.el.attributes.length, 0, "should not have generated any attribute"); assert.ok(_.isEmpty(widget.$el.html(), "should not have generated any content")); + widget.destroy(); }); QUnit.test('no template, custom tag', function (assert) { @@ -111,6 +117,7 @@ QUnit.module('core', {}, function () { widget.renderElement(); assert.strictEqual(widget.el.nodeName, 'UL', "should have generated the custom element tag"); + widget.destroy(); }); QUnit.test('no template, @id', function (assert) { @@ -124,6 +131,7 @@ QUnit.module('core', {}, function () { assert.strictEqual(widget.el.attributes.length, 1, "should have one attribute"); assert.hasAttrValue(widget.$el, 'id', 'foo', "should have generated the id attribute"); assert.strictEqual(widget.el.id, 'foo', "should also be available via property"); + widget.destroy(); }); QUnit.test('no template, @className', function (assert) { @@ -136,6 +144,7 @@ QUnit.module('core', {}, function () { assert.strictEqual(widget.el.className, 'oe_some_class', "should have the right property"); assert.hasAttrValue(widget.$el, 'class', 'oe_some_class', "should have the right attribute"); + widget.destroy(); }); QUnit.test('no template, bunch of attributes', function (assert) { @@ -166,6 +175,7 @@ QUnit.module('core', {}, function () { assert.hasAttrValue(widget.$el, 'clark', 'gable'); assert.hasAttrValue(widget.$el, 'spoiler', 'snape kills dumbledore'); + widget.destroy(); }); QUnit.test('template', function (assert) { @@ -193,6 +203,7 @@ QUnit.module('core', {}, function () { assert.strictEqual(widget.el.nodeName, 'OL'); assert.strictEqual(widget.$el.children().length, 5); assert.strictEqual(widget.el.textContent, '01234'); + widget.destroy(); }); QUnit.test('repeated', function (assert) { @@ -219,6 +230,8 @@ QUnit.module('core', {}, function () { widget.renderElement(); assert.strictEqual($fix.find('p').text(), '36', "DOM fixture should use new value"); assert.strictEqual(widget.$el.text(), '36', "should set new value"); + }).always(function () { + widget.destroy(); }); }); @@ -257,6 +270,7 @@ QUnit.module('core', {}, function () { assert.ok(widget.$('li:eq(3)').is(widget.$el.find('li:eq(3)')), "should do the same thing as calling find on the widget root"); + widget.destroy(); }); @@ -285,6 +299,7 @@ QUnit.module('core', {}, function () { for(var i=0; i<3; ++i) { assert.ok(a[i], "should pass test " + i); } + widget.destroy(); }); QUnit.test('undelegate', function (assert) { @@ -310,6 +325,7 @@ QUnit.module('core', {}, function () { widget.$('li').click(); assert.ok(!clicked, "undelegate should unbind events delegated"); assert.ok(newclicked, "undelegate should only unbind events it created"); + widget.destroy(); }); QUnit.module('Widget, and async stuff'); @@ -321,7 +337,8 @@ QUnit.module('core', {}, function () { return concurrency.asyncWhen(widget.start()) .then(function () { return widget.alive(concurrency.asyncWhen()); }) - .then(function () { assert.ok(true); }); + .then(function () { assert.ok(true); }) + .always(function () { widget.destroy(); }); }); QUnit.test("alive(dead)", function (assert) { @@ -355,7 +372,8 @@ QUnit.module('core', {}, function () { var widget = new (Widget.extend({})); return concurrency.asyncWhen(widget.start()) .then(function () { return widget.alive(concurrency.asyncWhen(), true) }) - .then(function () { assert.ok(true); }); + .then(function () { assert.ok(true); }) + .always(function () { widget.destroy(); }); }); QUnit.test("alive(dead, true)", function (assert) { @@ -445,4 +463,4 @@ QUnit.module('core', {}, function () { }); -});
\ No newline at end of file +}); |
