diff options
| author | Vincent Schippefilt <vsc@odoo.com> | 2019-04-05 07:48:02 +0000 |
|---|---|---|
| committer | Vincent Schippefilt <vsc@odoo.com> | 2019-04-05 10:13:41 +0000 |
| commit | eebb0c6152f270cfabb183f79fcf2b2e56918950 (patch) | |
| tree | 6c5c64874c8e91d2a3a6b5f4c5b154e5cffe3b28 /addons/web/static/tests/chrome | |
| parent | 6940cfddbc69570143e5dc9ddab21d4061b52dbf (diff) | |
[FIX] web: corrected the order of icons in systray
Since the merge of JQuery 3, the building of systray icons is non
deterministic.
After this fix, the menus are loaded correctly in order.
Task-ID: 1960741
closes odoo/odoo#32382
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests/chrome')
| -rw-r--r-- | addons/web/static/tests/chrome/systray_tests.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/addons/web/static/tests/chrome/systray_tests.js b/addons/web/static/tests/chrome/systray_tests.js new file mode 100644 index 00000000000..c5238ceff04 --- /dev/null +++ b/addons/web/static/tests/chrome/systray_tests.js @@ -0,0 +1,43 @@ +odoo.define('web.systray_tests', function (require) { + "use strict"; + + var testUtils = require('web.test_utils'); + var SystrayMenu = require('web.SystrayMenu'); + var Widget = require('web.Widget'); + + QUnit.test('Adding async components to the registry respects the sequence', async function (assert) { + assert.expect(2); + var parent = testUtils.createParent({ + }); + var prom = testUtils.makeTestPromise(); + + var synchronousFirstWidget = Widget.extend({ + sequence: 3, // bigger sequence means more to the left + start: function () { + this.$el.addClass('first'); + } + }); + var asynchronousSecondWidget = Widget.extend({ + sequence: 1, // smaller sequence means more to the right + willStart: function () { + return prom; + }, + start: function () { + this.$el.addClass('second'); + } + }); + + SystrayMenu.Items = [synchronousFirstWidget, asynchronousSecondWidget]; + var menu = new SystrayMenu(parent); + + menu.appendTo($('#qunit-fixture')); + await testUtils.nextTick(); + prom.resolve(); + await testUtils.nextTick(); + + assert.hasClass(menu.$('div:eq(0)'), 'first'); + assert.hasClass(menu.$('div:eq(1)'), 'second'); + + parent.destroy(); + }) +}); |
