0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/chat/test/javascripts/components/chat-navbar-threads-list-button-test.gjs
Kris a7bbcfe485
UX: hide chat header buttons for collapsed drawer chat, change minimize icon (#42279)
This simplifies the appearance of the drawer by hiding the header
buttons when collapsed, some of them didn't even work in this state


before
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/ec542d3c-8a9b-47e3-9a83-1ed86826de5c"
/>


after
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/5dd2ebe8-0ea7-4987-b37d-42d4280afa6c"
/>

clicking anywhere other than the x will expand the chat again, and when
using keyboard nav we still show the expand button as an accessibility
affordance:

<img width="400" alt="image"
src="https://github.com/user-attachments/assets/9d40b834-c47b-48ec-b312-3d8241e39969"
/>

the minimize icon change is similar to what we did for the composer in
https://github.com/discourse/discourse/issues/42017
2026-08-03 15:35:17 -04:00

43 lines
1.5 KiB
Text
Vendored

import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import ChatNavbarThreadsListButton from "discourse/plugins/chat/discourse/components/chat/navbar/threads-list-button";
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
module("Component | ChatNavbar | ThreadsListButton", function (hooks) {
setupRenderingTest(hooks, { stubRouter: true });
hooks.beforeEach(function () {
this.fabricators = new ChatFabricators(getOwner(this));
this.chatStateManager = getOwner(this).lookup("service:chat-state-manager");
this.channel = this.fabricators.channel();
this.channel.threadingEnabled = true;
});
test("shows the threads list button when threading is enabled", async function (assert) {
await render(
<template>
<ChatNavbarThreadsListButton @channel={{this.channel}} />
</template>
);
assert
.dom(".c-navbar__threads-list-button")
.exists("the threads list button is shown");
});
test("does not show the threads list button when the drawer is collapsed", async function (assert) {
this.chatStateManager.didCollapseDrawer();
await render(
<template>
<ChatNavbarThreadsListButton @channel={{this.channel}} />
</template>
);
assert
.dom(".c-navbar__threads-list-button")
.doesNotExist("the threads list button is hidden");
});
});