mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
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
46 lines
1.7 KiB
Text
Vendored
46 lines
1.7 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 ChatNavbarPinnedMessagesButton from "discourse/plugins/chat/discourse/components/chat/navbar/pinned-messages-button";
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
|
|
|
module("Component | ChatNavbar | PinnedMessagesButton", function (hooks) {
|
|
setupRenderingTest(hooks, { stubRouter: true });
|
|
|
|
hooks.beforeEach(function () {
|
|
this.siteSettings.chat_pinned_messages = true;
|
|
this.fabricators = new ChatFabricators(getOwner(this));
|
|
this.chatStateManager = getOwner(this).lookup("service:chat-state-manager");
|
|
this.channel = this.fabricators.channel();
|
|
this.channel.pinnedMessagesCount = 1;
|
|
// the button is only a way back to the pins panel once the bar is dismissed
|
|
this.channel.pinsDismissedAboveId = 1;
|
|
});
|
|
|
|
test("shows the button when the pinned bar is dismissed", async function (assert) {
|
|
await render(
|
|
<template>
|
|
<ChatNavbarPinnedMessagesButton @channel={{this.channel}} />
|
|
</template>
|
|
);
|
|
|
|
assert
|
|
.dom(".c-navbar__pinned-messages-btn")
|
|
.exists("the pinned messages button is shown");
|
|
});
|
|
|
|
test("does not show the button when the drawer is collapsed", async function (assert) {
|
|
this.chatStateManager.didCollapseDrawer();
|
|
|
|
await render(
|
|
<template>
|
|
<ChatNavbarPinnedMessagesButton @channel={{this.channel}} />
|
|
</template>
|
|
);
|
|
|
|
assert
|
|
.dom(".c-navbar__pinned-messages-btn")
|
|
.doesNotExist("the pinned messages button is hidden");
|
|
});
|
|
});
|