[IMP] mail: improve discuss counter style
To match the visual of the messaging menu badge for its counter. Task-3345133 closes odoo/odoo#122946 Related: odoo/enterprise#42493 Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
/>
|
||||
<t t-else="">$0</t>
|
||||
</xpath>
|
||||
<xpath expr="//*[@t-ref='unreadCounter']" position="replace">
|
||||
<xpath expr="//*[@t-ref='needactionCounter']" position="replace">
|
||||
<t t-if="!chatbotService.active">$0</t>
|
||||
</xpath>
|
||||
<xpath expr="//*[hasclass('o-mail-ChatWindow-header')]" position="attributes">
|
||||
|
||||
@@ -12,6 +12,10 @@ patch(Thread.prototype, "im_livechat", {
|
||||
return this.type === "livechat" || this._super();
|
||||
},
|
||||
|
||||
get isChatChannel() {
|
||||
return this.type === "livechat" || this._super();
|
||||
},
|
||||
|
||||
get isLastMessageFromCustomer() {
|
||||
if (this.type !== "livechat") {
|
||||
return this._super();
|
||||
|
||||
@@ -33,8 +33,8 @@ QUnit.test("new message from operator displays unread counter", async (assert) =
|
||||
thread_model: "discuss.channel",
|
||||
});
|
||||
});
|
||||
await waitUntil(".o-mail-ChatWindow-header:contains((1))");
|
||||
assert.containsOnce($, ".o-mail-ChatWindow-header:contains((1))");
|
||||
await waitUntil(".o-mail-ChatWindow-header:contains(1)");
|
||||
assert.containsOnce($, ".o-mail-ChatWindow-header:contains(1)");
|
||||
});
|
||||
|
||||
QUnit.test("focus on unread livechat marks it as read", async (assert) => {
|
||||
|
||||
@@ -293,7 +293,7 @@ QUnit.test("No counter if category is folded and without unread messages", async
|
||||
await openDiscuss();
|
||||
assert.containsNone(
|
||||
$,
|
||||
".o-mail-DiscussCategory-livechat .o-mail-DiscussCategory-counter",
|
||||
".o-mail-DiscussCategory-livechat .o-discuss-badge",
|
||||
"should not have a counter if the category is unfolded and with unread messages"
|
||||
);
|
||||
});
|
||||
@@ -324,10 +324,7 @@ QUnit.test(
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss();
|
||||
assert.strictEqual(
|
||||
$(".o-mail-DiscussCategory-livechat .o-mail-DiscussCategory-counter").text(),
|
||||
"1"
|
||||
);
|
||||
assert.strictEqual($(".o-mail-DiscussCategory-livechat .o-discuss-badge").text(), "1");
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.o-mail-ChatWindow-counter {
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
.o-mail-ChatWindow-header {
|
||||
height: $o-mail-Discuss-headerHeight;
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
'ms-3 me-1 my-0': !thread,
|
||||
}"
|
||||
/>
|
||||
<div t-if="thread and thread.isChannel and thread.message_unread_counter > 0" class="mx-1 my-0" t-ref="unreadCounter">
|
||||
(<t t-out="thread.message_unread_counter"/>)
|
||||
</div>
|
||||
<div class="flex-grow-1"/>
|
||||
<div t-if="thread and thread.needactionCounter > 0" class="o-mail-ChatWindow-counter mx-1 my-0 badge rounded-pill fw-bold o-discuss-badge" t-ref="needactionCounter">
|
||||
<t t-out="thread.needactionCounter"/>
|
||||
</div>
|
||||
<t t-if="threadActions.actions.length > 1">
|
||||
<t t-set="firstAction" t-value="threadActions.actions[0]"/>
|
||||
<button class="o-mail-ChatWindow-command btn d-flex p-2 opacity-75 opacity-100-hover" t-att-title="firstAction.name" t-on-click.stop="() => firstAction.onSelect()"><i t-att-class="firstAction.icon"/></button>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.o-discuss-badge {
|
||||
background-color: $primary;
|
||||
}
|
||||
@@ -2,6 +2,18 @@
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
.o-discuss-badge {
|
||||
--o-discuss-badge-bg: #{$o-success}; // sync with --o-navbar-badge-bg
|
||||
color: $white !important;
|
||||
background-color: var(--o-discuss-badge-bg) !important;
|
||||
}
|
||||
|
||||
.o-discuss-badge, .o-discuss-badgeShape {
|
||||
display: flex;
|
||||
transform: translate(0, 0) !important; // cancel systray style on badge
|
||||
font-size: 0.7em !important;
|
||||
}
|
||||
|
||||
.o-min-width-0 {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -277,6 +277,10 @@ export class Thread {
|
||||
return createLocalId(this.model, this.id);
|
||||
}
|
||||
|
||||
get needactionCounter() {
|
||||
return this.isChatChannel ? this.message_unread_counter : this.message_needaction_counter;
|
||||
}
|
||||
|
||||
/** @returns {import("@mail/core/common/message_model").Message | undefined} */
|
||||
get newestMessage() {
|
||||
return [...this.messages].reverse().find((msg) => !msg.isEmpty);
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<t t-set="message" t-value="thread.isChatChannel or (thread.type === 'channel' and !thread.hasNeedactionMessages) ? thread.newestMessage : thread.newestNeedactionMessage"/>
|
||||
<NotificationItem
|
||||
body="message?.inlineBody"
|
||||
counter="thread.isChatChannel ? thread.message_unread_counter : thread.hasNeedactionMessages ? thread.message_needaction_counter : undefined"
|
||||
counter="thread.needactionCounter"
|
||||
datetime="message?.datetime"
|
||||
displayName="thread.displayName"
|
||||
iconSrc="thread.imgUrl"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { ImStatus } from "@mail/core/common/im_status";
|
||||
import { RelativeTime } from "@mail/core/common/relative_time";
|
||||
import { useHover } from "@mail/utils/common/hooks";
|
||||
|
||||
import { Component, useRef } from "@odoo/owl";
|
||||
|
||||
@@ -28,6 +29,7 @@ export class NotificationItem extends Component {
|
||||
|
||||
setup() {
|
||||
this.markAsReadRef = useRef("markAsRead");
|
||||
this.rootHover = useHover("root");
|
||||
}
|
||||
|
||||
onClick(ev) {
|
||||
|
||||
@@ -24,3 +24,21 @@ $o-mail-NotificationItem-muted-hover-background-color:
|
||||
}
|
||||
}
|
||||
|
||||
.o-mail-NotificationItem-badge {
|
||||
padding: 3px 6px !important;
|
||||
}
|
||||
|
||||
.o-mail-NotificationItem-markAsRead {
|
||||
background-color: transparent !important;
|
||||
|
||||
&:hover {
|
||||
color: $success !important;
|
||||
background-color: rgba(0, 0, 0, 0.075) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.o-mail-NotificationItem-text:before {
|
||||
// invisible character so that typing status bar has constant height, regardless of text content.
|
||||
content: "\200b"; /* unicode zero width space character */
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<t t-name="mail.NotificationItem" owl="1">
|
||||
<ActionSwiper onLeftSwipe="props.onSwipeLeft ? props.onSwipeLeft : undefined" onRightSwipe="props.onSwipeRight ? props.onSwipeRight : undefined">
|
||||
<div class="o-mail-NotificationItem d-flex cursor-pointer align-items-center p-1" t-att-class="{ 'o-muted': !props.hasMarkAsReadButton }" t-on-click="onClick">
|
||||
<div class="o-mail-NotificationItem d-flex cursor-pointer align-items-center p-1" t-att-class="{ 'o-muted': !props.hasMarkAsReadButton }" t-on-click="onClick" t-ref="root">
|
||||
<div class="position-relative o-bg-inherit m-1 flex-shrink-0" style="width:40px;height:40px;">
|
||||
<img class="o_avatar w-100 h-100 rounded" alt="Notification Item Image" t-att-src="props.iconSrc"/>
|
||||
<t t-slot="icon"/>
|
||||
@@ -11,9 +11,8 @@
|
||||
<div class="d-flex flex-column flex-grow-1 align-self-start m-2 overflow-auto">
|
||||
<div class="d-flex text-nowrap">
|
||||
<span class="o-mail-NotificationItem-name text-truncate" t-att-class="props.hasMarkAsReadButton ? 'fw-bolder' : 'fw-bold'" t-esc="props.displayName"/>
|
||||
<span t-if="props.counter > 0" class="o-mail-NotificationItem-counter mx-1" t-att-class="props.hasMarkAsReadButton ? 'fw-bolder' : fw-bold"> (<t t-esc="props.counter"/>)</span>
|
||||
<span class="flex-grow-1"/>
|
||||
<small t-if="props.datetime" class="o-mail-NotificationItem-date text-muted opacity-50 ms-2">
|
||||
<small t-if="props.datetime" class="o-mail-NotificationItem-date ms-2" t-att-class="{ 'opacity-75 fw-bold': props.counter > 0, 'opacity-50 text-muted': props.counter === 0 }">
|
||||
<RelativeTime datetime="props.datetime"/>
|
||||
</small>
|
||||
|
||||
@@ -24,7 +23,10 @@
|
||||
<t t-if="props.body" t-esc="props.body" name="notificationBody"/>
|
||||
</div>
|
||||
<div class="flex-grow-1"/>
|
||||
<i t-if="props.hasMarkAsReadButton" class="o-mail-NotificationItem-markAsRead fa fa-check d-flex ms-2 text-600 opacity-50 opacity-100-hover cursor-pointer" title="Mark As Read" t-ref="markAsRead"/>
|
||||
<div class="d-flex align-items-center">
|
||||
<span t-if="props.counter > 0 and !rootHover.isHover" class="o-mail-NotificationItem-badge o-discuss-badge d-flex align-items-center justify-content-center m-0 badge rounded-pill fw-bold o-mail-NotificationItem-counter"><t t-esc="props.counter"/></span>
|
||||
<span t-if="props.hasMarkAsReadButton and rootHover.isHover" class="o-mail-NotificationItem-badge o-discuss-badgeShape text-success d-flex align-items-center justify-content-center m-0 badge rounded-pill fw-bold o-mail-NotificationItem-markAsRead fa fa-check text-600 opacity-50 opacity-100-hover cursor-pointer" title="Mark As Read" t-ref="markAsRead"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.o-mail-DiscussSidebar-badge {
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
.o-mail-DiscussCategoryItem-threadIcon {
|
||||
font-size: xx-small;
|
||||
width: 13px;
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
<t t-esc="mailbox.name"/>
|
||||
</div>
|
||||
<div t-attf-class="flex-grow-1 {{ mailbox.counter === 0 ? 'me-3': '' }}"/>
|
||||
<div t-if="mailbox.counter > 0" t-attf-class="badge rounded-pill {{ mailbox.id === 'starred' ? 'bg-400 text-light' : 'text-bg-primary' }} ms-1 me-3">
|
||||
<t t-esc="mailbox.counter"/>
|
||||
<div t-if="mailbox.counter > 0">
|
||||
<span t-attf-class="o-mail-DiscussSidebar-badge badge rounded-pill o-discuss-badge {{ mailbox.id === 'starred' ? 'bg-400 text-light' : '' }} ms-1 me-3 fw-bold" t-esc="mailbox.counter"/>
|
||||
</div>
|
||||
</button>
|
||||
</t>
|
||||
@@ -56,7 +56,7 @@
|
||||
<i t-if="category.canView" t-attf-class="fa fa-cog {{ hover_class }}" title="View or join channels" t-on-click="() => this.openCategory(category)" role="img"/>
|
||||
<i t-if="category.canAdd and category.isOpen" class="o-mail-DiscussCategory-add" t-attf-class="fa fa-plus {{ hover_class }} ms-1" t-on-click="() => this.addToCategory(category)" t-att-title="category.addTitle" role="img"/>
|
||||
</div>
|
||||
<div t-if="!category.isOpen and threadService.getDiscussCategoryCounter(category.id) > 0" class="o-mail-DiscussCategory-counter badge rounded-pill text-bg-primary me-3">
|
||||
<div t-if="!category.isOpen and threadService.getDiscussCategoryCounter(category.id) > 0" class="o-mail-DiscussSidebar-badge badge rounded-pill me-3 o-discuss-badge fw-bold">
|
||||
<t t-esc="threadService.getDiscussCategoryCounter(category.id)"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -99,8 +99,8 @@
|
||||
<div t-if="threadService.canUnpin(thread)" t-attf-class="fa fa-times ms-1 {{ hover_class }}" t-on-click.stop="() => threadService.unpin(thread)" title="Unpin Conversation" role="img"/>
|
||||
</div>
|
||||
<div t-if="Object.keys(thread.rtcSessions).length > 0" class="fa fa-volume-up ms-1 me-3" t-att-class="{ 'text-danger': rtc.state.channel?.id === thread.id }"/>
|
||||
<div t-if="counter > 0" t-attf-class="o-mail-DiscussCategoryItem-counter badge rounded-pill text-bg-primary ms-1 me-3">
|
||||
<t t-esc="counter"/>
|
||||
<div t-if="counter > 0">
|
||||
<span t-attf-class="o-mail-DiscussSidebar-badge badge rounded-pill o-discuss-badge ms-1 me-3 fw-bold" t-esc="counter"/>
|
||||
</div>
|
||||
</button>
|
||||
</t>
|
||||
|
||||
@@ -352,11 +352,11 @@ QUnit.test("chat - channel should count unread message [REQUIRE FOCUS]", async (
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss();
|
||||
assert.containsOnce($, ".o-mail-DiscussCategoryItem-counter");
|
||||
assert.strictEqual($(".o-mail-DiscussCategoryItem-counter").text(), "1");
|
||||
assert.containsOnce($, ".o-discuss-badge");
|
||||
assert.strictEqual($(".o-discuss-badge").text(), "1");
|
||||
|
||||
await click(".o-mail-DiscussCategoryItem:contains(Demo)");
|
||||
assert.containsNone($, ".o-mail-DiscussCategoryItem-counter");
|
||||
assert.containsNone($, ".o-discuss-badge");
|
||||
});
|
||||
|
||||
QUnit.test("mark channel as seen on last message visible [REQUIRE FOCUS]", async (assert) => {
|
||||
@@ -1178,7 +1178,7 @@ QUnit.test("Group unread counter up to date after mention is marked as seen", as
|
||||
]);
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss();
|
||||
assert.containsOnce($, ".o-mail-DiscussCategoryItem-counter");
|
||||
assert.containsOnce($, ".o-mail-DiscussCategoryItem .o-discuss-badge");
|
||||
await click(".o-mail-DiscussCategoryItem");
|
||||
await waitUntil(".o-mail-DiscussCategoryItem-counter", 0);
|
||||
await waitUntil(".o-discuss-badge", 0);
|
||||
});
|
||||
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { makeFakeNotificationService } from "@web/../tests/helpers/mock_services";
|
||||
import { patchWithCleanup, triggerEvent, triggerHotkey } from "@web/../tests/helpers/utils";
|
||||
import { patchBrowserNotification } from "@mail/../tests/helpers/patch_notifications";
|
||||
import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import { patchWithCleanup, triggerHotkey } from "@web/../tests/helpers/utils";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
|
||||
QUnit.module("messaging menu");
|
||||
|
||||
@@ -182,7 +182,7 @@ QUnit.test("grouped notifications by document", async (assert) => {
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner (2))");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner) .badge:contains(2)");
|
||||
assert.containsNone($, ".o-mail-ChatWindow");
|
||||
|
||||
await click(".o-mail-NotificationItem");
|
||||
@@ -241,7 +241,7 @@ QUnit.test("grouped notifications by document model", async (assert) => {
|
||||
},
|
||||
});
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner (2))");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner) .badge:contains(2)");
|
||||
|
||||
$(".o-mail-NotificationItem")[0].click();
|
||||
assert.verifySteps(["do_action"]);
|
||||
@@ -339,12 +339,14 @@ QUnit.test("mark unread channel as read", async (assert) => {
|
||||
},
|
||||
});
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await triggerEvent($(".o-mail-NotificationItem")[0], null, "mouseenter");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem [title='Mark As Read']");
|
||||
|
||||
await click(".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await click(".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.verifySteps(["set_last_seen_message"]);
|
||||
assert.hasClass($(".o-mail-NotificationItem"), "o-muted");
|
||||
assert.containsNone($, ".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await triggerEvent($(".o-mail-NotificationItem")[0], null, "mouseenter");
|
||||
assert.containsNone($, ".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsNone($, ".o-mail-ChatWindow");
|
||||
});
|
||||
|
||||
@@ -372,9 +374,10 @@ QUnit.test("mark failure as read", async (assert) => {
|
||||
$,
|
||||
".o-mail-NotificationItem:contains(An error occurred when sending an email)"
|
||||
);
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Channel) i[title='Mark As Read']");
|
||||
await triggerEvent($(".o-mail-NotificationItem:contains(Channel)")[0], null, "mouseenter");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Channel) [title='Mark As Read']");
|
||||
|
||||
await click(".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await click(".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsNone($, ".o-mail-NotificationItem:contains(Channel)");
|
||||
assert.containsNone(
|
||||
$,
|
||||
@@ -428,7 +431,7 @@ QUnit.test("different discuss.channel are not grouped", async (assert) => {
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsN($, ".o-mail-NotificationItem", 4);
|
||||
|
||||
const group_1 = $(".o-mail-NotificationItem:contains(Channel (2)):first");
|
||||
const group_1 = $(".o-mail-NotificationItem:contains(Channel):first");
|
||||
await click(group_1);
|
||||
assert.containsOnce($, ".o-mail-ChatWindow");
|
||||
});
|
||||
@@ -869,7 +872,8 @@ QUnit.test(
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsN($, ".o-mail-NotificationItem", 1);
|
||||
assert.ok($(".o-mail-NotificationItem").text().includes("Test (1)"));
|
||||
assert.ok($(".o-mail-NotificationItem").text().includes("Test"));
|
||||
assert.ok($(".o-mail-NotificationItem .badge").text().includes("1"));
|
||||
assert.ok($(".o-mail-NotificationItem").text().includes("Message with needaction"));
|
||||
}
|
||||
);
|
||||
@@ -891,7 +895,7 @@ QUnit.test("chat should show unread counter on receiving new messages", async (a
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner1)");
|
||||
assert.containsNone($, ".o-mail-NotificationItem:contains('Partner1 (1)')");
|
||||
assert.containsNone($, ".o-mail-NotificationItem .badge:contains('1')");
|
||||
// simulate receiving a new message
|
||||
const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
|
||||
pyEnv["bus.bus"]._sendone(channel, "discuss.channel/new_message", {
|
||||
@@ -904,7 +908,7 @@ QUnit.test("chat should show unread counter on receiving new messages", async (a
|
||||
res_id: channelId,
|
||||
},
|
||||
});
|
||||
await waitUntil(".o-mail-NotificationItem:contains('Partner1 (1)')");
|
||||
await waitUntil(".o-mail-NotificationItem .badge:contains('1')");
|
||||
});
|
||||
|
||||
QUnit.test("preview for channel should show latest non-deleted message", async (assert) => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { afterNextRender, click, start, startServer } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { patchWithCleanup, triggerEvent } from "@web/../tests/helpers/utils";
|
||||
|
||||
QUnit.module("notification");
|
||||
|
||||
@@ -58,6 +58,11 @@ QUnit.test("mark as read", async (assert) => {
|
||||
});
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
await triggerEvent(
|
||||
$(".o-mail-NotificationItem-name:contains(Channel)").closest(".o-mail-NotificationItem")[0],
|
||||
null,
|
||||
"mouseenter"
|
||||
);
|
||||
assert.containsOnce(
|
||||
$(".o-mail-NotificationItem-name:contains(Channel)").closest(".o-mail-NotificationItem"),
|
||||
".o-mail-NotificationItem-markAsRead"
|
||||
|
||||
@@ -919,10 +919,9 @@ QUnit.test(
|
||||
id: channelId,
|
||||
message: formattedMessage,
|
||||
});
|
||||
await waitUntil(".o-mail-DiscussCategoryItem-counter:contains(1)");
|
||||
await waitUntil("button:contains(Inbox) .badge:contains(1)");
|
||||
await click("button:contains(General)");
|
||||
await waitUntil(".o-mail-DiscussCategoryItem-counter", 0);
|
||||
await waitUntil(".o-discuss-badge", 0);
|
||||
await waitUntil("button:contains(Inbox) .badge", 0);
|
||||
assert.verifySteps(["mark-all-messages-as-read"]);
|
||||
}
|
||||
@@ -981,10 +980,10 @@ QUnit.test("can be marked as read while loading", async function (assert) {
|
||||
},
|
||||
});
|
||||
await openDiscuss(undefined, { waitUntilMessagesLoaded: false });
|
||||
assert.containsOnce($, ".o-mail-DiscussCategoryItem-counter:contains(1)");
|
||||
assert.containsOnce($, ".o-discuss-badge:contains(1)");
|
||||
await click(".o-mail-DiscussCategoryItem:contains(Demo)");
|
||||
await afterNextRender(loadDeferred.resolve);
|
||||
assert.containsNone($, ".o-mail-DiscussCategoryItem-counter");
|
||||
assert.containsNone($, ".o-discuss-badge");
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { start, startServer, click } from "@mail/../tests/helpers/test_utils";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { patchWithCleanup, triggerEvent } from "@web/../tests/helpers/utils";
|
||||
|
||||
QUnit.module("message menu (patch)");
|
||||
QUnit.module("messaging menu (patch)");
|
||||
|
||||
QUnit.test("mark as read", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
@@ -21,12 +21,13 @@ QUnit.test("mark as read", async (assert) => {
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await triggerEvent($(".o-mail-NotificationItem")[0], null, "mouseenter");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsOnce(
|
||||
$,
|
||||
".o-mail-NotificationItem:contains(An error occurred when sending an SMS)"
|
||||
);
|
||||
await click(".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await click(".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsNone($, ".o-mail-NotificationItem");
|
||||
});
|
||||
|
||||
@@ -73,9 +74,11 @@ QUnit.test("notifications grouped by notification_type", async (assert) => {
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsN($, ".o-mail-NotificationItem", 2);
|
||||
const items = $(".o-mail-NotificationItem");
|
||||
assert.ok(items[0].textContent.includes("Partner (2)"));
|
||||
assert.ok(items[0].textContent.includes("Partner"));
|
||||
assert.ok(items[0].textContent.includes("2")); // counter
|
||||
assert.ok(items[0].textContent.includes("An error occurred when sending an email"));
|
||||
assert.ok(items[1].textContent.includes("Partner (2)"));
|
||||
assert.ok(items[1].textContent.includes("Partner"));
|
||||
assert.ok(items[1].textContent.includes("2")); // counter
|
||||
assert.ok(items[1].textContent.includes("An error occurred when sending an SMS"));
|
||||
});
|
||||
|
||||
@@ -133,7 +136,7 @@ QUnit.test("grouped notifications by document model", async (assert) => {
|
||||
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner (2))");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner) .badge:contains(2)");
|
||||
await click(".o-mail-NotificationItem");
|
||||
assert.verifySteps(["do_action"]);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { start, startServer, click } from "@mail/../tests/helpers/test_utils";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { patchWithCleanup, triggerEvent } from "@web/../tests/helpers/utils";
|
||||
|
||||
QUnit.module("message menu (patch)");
|
||||
QUnit.module("messaging menu (patch)");
|
||||
|
||||
QUnit.test("mark as read", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
@@ -23,12 +23,13 @@ QUnit.test("mark as read", async (assert) => {
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await triggerEvent($(".o-mail-NotificationItem")[0], null, "mouseenter");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsOnce(
|
||||
$,
|
||||
".o-mail-NotificationItem:contains(An error occurred when sending a letter with Snailmail.)"
|
||||
);
|
||||
await click(".o-mail-NotificationItem i[title='Mark As Read']");
|
||||
await click(".o-mail-NotificationItem [title='Mark As Read']");
|
||||
assert.containsNone($, ".o-mail-NotificationItem");
|
||||
});
|
||||
|
||||
@@ -74,13 +75,15 @@ QUnit.test("notifications grouped by notification_type", async (assert) => {
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsN($, ".o-mail-NotificationItem", 2);
|
||||
assert.ok($(".o-mail-NotificationItem:eq(0)").text().includes("Partner (2)"));
|
||||
assert.ok($(".o-mail-NotificationItem:eq(0)").text().includes("Partner"));
|
||||
assert.ok($(".o-mail-NotificationItem:eq(0)").text().includes("2")); // counter
|
||||
assert.ok(
|
||||
$(".o-mail-NotificationItem:eq(0)")
|
||||
.text()
|
||||
.includes("An error occurred when sending an email")
|
||||
);
|
||||
assert.ok($(".o-mail-NotificationItem:eq(1)").text().includes("Partner (2)"));
|
||||
assert.ok($(".o-mail-NotificationItem:eq(1)").text().includes("Partner"));
|
||||
assert.ok($(".o-mail-NotificationItem:eq(1)").text().includes("2")); // counter
|
||||
assert.ok(
|
||||
$(".o-mail-NotificationItem:eq(1)")
|
||||
.text()
|
||||
@@ -142,7 +145,8 @@ QUnit.test("grouped notifications by document model", async (assert) => {
|
||||
});
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner (2))");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(Partner)");
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(2)"); // counter
|
||||
await click(".o-mail-NotificationItem");
|
||||
assert.verifySteps(["do_action"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user