mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 02:59:07 +08:00
This fixes an issue where scrolling in a livestream topic loses the chat sidebar. The body class had to be based on the topic rather than the event card so the class can persist. Added a test to make sure it doesn't regress.
42 lines
1.4 KiB
Text
Vendored
42 lines
1.4 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 EmbeddableChatChannelConnector from "../../discourse/connectors/before-main-outlet/embeddable-chat-channel-connector";
|
|
|
|
module(
|
|
"Integration | Component | Livestream | embeddable chat channel connector",
|
|
function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
function stubEmbeddableChat(context, useLivestreamLayout) {
|
|
const owner = getOwner(context);
|
|
owner.unregister("service:embeddable-chat");
|
|
owner.register(
|
|
"service:embeddable-chat",
|
|
{
|
|
useLivestreamLayout,
|
|
chatChannelId: 9,
|
|
canRenderChatChannel: () => false,
|
|
},
|
|
{ instantiate: false }
|
|
);
|
|
}
|
|
|
|
test("applies the livestream body class from outside the post stream", async function (assert) {
|
|
stubEmbeddableChat(this, true);
|
|
|
|
await render(<template><EmbeddableChatChannelConnector /></template>);
|
|
|
|
assert.dom(document.body).hasClass("livestream-topic");
|
|
});
|
|
|
|
test("omits the livestream body class when the layout does not apply", async function (assert) {
|
|
stubEmbeddableChat(this, false);
|
|
|
|
await render(<template><EmbeddableChatChannelConnector /></template>);
|
|
|
|
assert.dom(document.body).doesNotHaveClass("livestream-topic");
|
|
});
|
|
}
|
|
);
|