diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-06-23 17:03:08 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-06-24 10:22:58 +0000 |
| commit | 652d835f77da3e19eeb70a4a2fec46fd9bff8b46 (patch) | |
| tree | 4811bc7e65eaacb5ad29eb715baac266567765d5 /addons/mail/static/tests | |
| parent | ba744be93748063ac9b051509d99f6b582e0df20 (diff) | |
[FIX] mail: restore close of other menus on click of messaging menu
task-2278830
closes odoo/odoo#53566
X-original-commit: 0407151b34da16ca54066bb15e578dc1db85f365
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/tests')
| -rw-r--r-- | addons/mail/static/tests/systray/systray_activity_menu_tests.js | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/addons/mail/static/tests/systray/systray_activity_menu_tests.js b/addons/mail/static/tests/systray/systray_activity_menu_tests.js index 68602e237e7..0258b35652f 100644 --- a/addons/mail/static/tests/systray/systray_activity_menu_tests.js +++ b/addons/mail/static/tests/systray/systray_activity_menu_tests.js @@ -1,7 +1,10 @@ odoo.define('mail.systray.ActivityMenuTests', function (require) { "use strict"; -const { start } = require('mail/static/src/utils/test_utils.js'); +const { + afterNextRender, + start, +} = require('mail/static/src/utils/test_utils.js'); var ActivityMenu = require('mail.systray.ActivityMenu'); var testUtils = require('web.test_utils'); @@ -15,10 +18,10 @@ QUnit.module('ActivityMenu', { name: { type: "char" }, model: { type: "char" }, type: { type: "char" }, - planned_count: { type: "integer"}, - today_count: { type: "integer"}, - overdue_count: { type: "integer"}, - total_count: { type: "integer"}, + planned_count: { type: "integer" }, + today_count: { type: "integer" }, + overdue_count: { type: "integer" }, + total_count: { type: "integer" }, actions: [{ icon: { type: "char" }, name: { type: "char" }, @@ -181,17 +184,17 @@ QUnit.test('activity menu widget: activity view icon', async function (assert) { var $second = activityMenu.$('.o_mail_activity_action').eq(1); assert.strictEqual($first.data('model_name'), "Issue", "first activity action should link to 'Issue'"); - assert.hasClass($first,'fa-clock-o', "should display the activity action icon"); + assert.hasClass($first, 'fa-clock-o', "should display the activity action icon"); assert.strictEqual($second.data('model_name'), "Note", "Second activity action should link to 'Note'"); - assert.hasClass($second,'fa-clock-o', "should display the activity action icon"); + assert.hasClass($second, 'fa-clock-o', "should display the activity action icon"); testUtils.mock.intercept(activityMenu, 'do_action', function (ev) { if (ev.data.action.name) { assert.ok(ev.data.action.domain, "should define a domain on the action"); assert.deepEqual(ev.data.action.domain, [["activity_ids.user_id", "=", 10]], - "should set domain to user's activity only") + "should set domain to user's activity only"); assert.step('do_action:' + ev.data.action.name); } else { assert.step('do_action:' + ev.data.action); @@ -218,5 +221,42 @@ QUnit.test('activity menu widget: activity view icon', async function (assert) { widget.destroy(); }); + +QUnit.test('activity menu widget: close on messaging menu click', async function (assert) { + assert.expect(2); + + const { widget } = await start({ + hasMessagingMenu: true, + async mockRPC(route, args) { + if (args.method === 'systray_get_activities') { + return []; + } + return this._super(route, args); + }, + }); + const activityMenu = new ActivityMenu(widget); + await activityMenu.appendTo($('#qunit-fixture')); + await testUtils.nextTick(); + + await testUtils.dom.click(activityMenu.$('.dropdown-toggle')); + assert.hasClass( + activityMenu.el.querySelector('.o_mail_systray_dropdown'), + 'show', + "activity menu should be shown after click on itself" + ); + + await afterNextRender(() => + document.querySelector(`.o_MessagingMenu_toggler`).click() + ); + assert.doesNotHaveClass( + activityMenu.el.querySelector('.o_mail_systray_dropdown'), + 'show', + "activity menu should be hidden after click on messaging menu" + ); + + widget.destroy(); +}); + }); + }); |
