mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Revert "DEV: rework the chat-live-pane" (#20510)
This reverts commit 67c0498f6475f56472308d25441ea2a817dd1891.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import User from "discourse/models/user";
|
||||
import { render } from "@ember/test-helpers";
|
||||
import { render, waitFor } from "@ember/test-helpers";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
@ -21,16 +21,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
unread_count: 0,
|
||||
muted: false,
|
||||
},
|
||||
canInteractWithChat: true,
|
||||
canDeleteSelf: true,
|
||||
canDeleteOthers: true,
|
||||
canFlag: true,
|
||||
userSilenced: false,
|
||||
canModerate: true,
|
||||
});
|
||||
return {
|
||||
message: ChatMessage.create(
|
||||
chatChannel,
|
||||
Object.assign(
|
||||
{
|
||||
id: 178,
|
||||
@ -45,6 +38,14 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
messageData
|
||||
)
|
||||
),
|
||||
canInteractWithChat: true,
|
||||
details: {
|
||||
can_delete_self: true,
|
||||
can_delete_others: true,
|
||||
can_flag: true,
|
||||
user_silenced: false,
|
||||
can_moderate: true,
|
||||
},
|
||||
chatChannel,
|
||||
setReplyTo: () => {},
|
||||
replyMessageClicked: () => {},
|
||||
@ -54,9 +55,8 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
onStartSelectingMessages: () => {},
|
||||
onSelectMessage: () => {},
|
||||
bulkSelectMessages: () => {},
|
||||
afterReactionAdded: () => {},
|
||||
onHoverMessage: () => {},
|
||||
didShowMessage: () => {},
|
||||
didHideMessage: () => {},
|
||||
};
|
||||
}
|
||||
|
||||
@ -64,7 +64,8 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
<ChatMessage
|
||||
@message={{this.message}}
|
||||
@canInteractWithChat={{this.canInteractWithChat}}
|
||||
@channel={{this.chatChannel}}
|
||||
@details={{this.details}}
|
||||
@chatChannel={{this.chatChannel}}
|
||||
@setReplyTo={{this.setReplyTo}}
|
||||
@replyMessageClicked={{this.replyMessageClicked}}
|
||||
@editButtonClicked={{this.editButtonClicked}}
|
||||
@ -73,8 +74,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
@onSelectMessage={{this.onSelectMessage}}
|
||||
@bulkSelectMessages={{this.bulkSelectMessages}}
|
||||
@onHoverMessage={{this.onHoverMessage}}
|
||||
@didShowMessage={{this.didShowMessage}}
|
||||
@didHideMessage={{this.didHideMessage}}
|
||||
@afterReactionAdded={{this.reStickScrollIfNeeded}}
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -90,7 +90,6 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
test("Deleted message", async function (assert) {
|
||||
this.setProperties(generateMessageProps({ deleted_at: moment() }));
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-deleted .chat-message-expand"),
|
||||
"has the correct deleted css class and expand button within"
|
||||
@ -105,4 +104,16 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
"has the correct hidden css class and expand button within"
|
||||
);
|
||||
});
|
||||
|
||||
test("Message marked as visible", async function (assert) {
|
||||
this.setProperties(generateMessageProps());
|
||||
|
||||
await render(template);
|
||||
await waitFor("div[data-visible=true]");
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-container[data-visible=true]"),
|
||||
"message is marked as visible"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user