mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
UX: hides header's unread indicator on full page (#23370)
The unread(s) will still show in the sidebar, outside of chat and when in drawer mode. This is to prevent the confusion to show an unread count for chat on a button which is going to take the user out of chat.
This commit is contained in:
@ -4,6 +4,7 @@ import { render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import sinon from "sinon";
|
||||
import I18n from "I18n";
|
||||
import { HEADER_INDICATOR_PREFERENCE_ALL_NEW } from "discourse/plugins/chat/discourse/controllers/preferences-chat";
|
||||
|
||||
module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -54,4 +55,41 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
});
|
||||
|
||||
test("full page - with unread", async function (assert) {
|
||||
this.currentUser.user_option.chat_separate_sidebar_mode = "always";
|
||||
this.currentUser.user_option.chat_header_indicator_preference =
|
||||
HEADER_INDICATOR_PREFERENCE_ALL_NEW;
|
||||
|
||||
sinon
|
||||
.stub(this.owner.lookup("service:chat-state-manager"), "isFullPageActive")
|
||||
.value(true);
|
||||
|
||||
await render(hbs`<Chat::Header::Icon @urgentCount={{1}} />`);
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("sidebar.panels.forum.label"))
|
||||
.hasAttribute("href", "/latest");
|
||||
assert.dom(".d-icon-random").exists();
|
||||
assert.dom(".chat-channel-unread-indicator__number").doesNotExist();
|
||||
});
|
||||
|
||||
test("drawer - with unread", async function (assert) {
|
||||
this.currentUser.user_option.chat_separate_sidebar_mode = "always";
|
||||
this.currentUser.user_option.chat_header_indicator_preference =
|
||||
HEADER_INDICATOR_PREFERENCE_ALL_NEW;
|
||||
|
||||
await render(hbs`<Chat::Header::Icon @urgentCount={{1}} />`);
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("sidebar.panels.chat.label"))
|
||||
.hasAttribute("href", "/chat");
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
assert
|
||||
.dom(".chat-channel-unread-indicator__number")
|
||||
.exists()
|
||||
.containsText("1");
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user