mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 12:08:12 -05:00
FIX: hides redundant chat icon on mobile chat routes (#35015)
### Chat in Mobile view In order to reduce visual noise in mobile view, there is no need to show chat icon in header, once user has already chat open. |Before|After| |---|---| |<img width="456" height="199" alt="Screenshot 2025-10-01 at 17 16 29" src="https://github.com/user-attachments/assets/6d124a79-4a0a-4edd-913a-43a0cfa05623" />|<img width="442" height="198" alt="Screenshot 2025-10-01 at 17 16 06" src="https://github.com/user-attachments/assets/052a2f78-574e-4d35-aff4-264f54f2fb15" />|
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { render, settled } from "@ember/test-helpers";
|
||||
import { module, test } from "qunit";
|
||||
import sinon from "sinon";
|
||||
import { forceMobile } from "discourse/lib/mobile";
|
||||
@@ -43,16 +44,30 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
});
|
||||
|
||||
test("mobile", async function (assert) {
|
||||
const testState = new (class {
|
||||
@tracked isActive = false;
|
||||
})();
|
||||
|
||||
forceMobile();
|
||||
|
||||
await render(<template><Icon /></template>);
|
||||
await render(
|
||||
<template><Icon @isActive={{testState.isActive}} /></template>
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", i18n("chat.title_capitalized"))
|
||||
.hasAttribute("href", "/chat");
|
||||
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
assert
|
||||
.dom(".d-icon-d-chat")
|
||||
.exists("chat icon is rendered if chat is inactive");
|
||||
|
||||
testState.isActive = true;
|
||||
await settled();
|
||||
assert
|
||||
.dom(".d-icon-d-chat")
|
||||
.doesNotExist("chat icon is not rendered if chat is active");
|
||||
});
|
||||
|
||||
test("full page - with unread", async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user