mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
REFACTOR: <ChatMessage> component (#22172)
- Moves `<ChatMessageInfo />` to `<Chat::Message::Info />` - Moves `<ChatMessageAvatar />` to `<Chat::Message::Avatar />` - Moves `<ChatMessageLeftGutter />` to `<Chat::Message::LeftGutter />`, adds tests - Creates `<Chat::Message::Error />` - Creates `<Chat::Message::MentionWarning />`, adds tests and a styleguide - Creates a model for ChatMessageMentionWarning, adds fabricator for it - Keeps the enter/leave viewport logic inside the `<ChatMessage />` component instead of bubbling it to the channel and thread components - Adds a scale animation when clicking a reaction - Creates `chat/later-fn` modifier which accepts a function and a delay. It allows to call a function Xms after a component has been inserted, it's useful for animations. - Moves css code out of chat-message into relevant files - Deletes unused code <!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
This commit is contained in:
@ -9,11 +9,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
const template = hbs`
|
||||
<ChatMessage
|
||||
@message={{this.message}}
|
||||
@messageDidEnterViewport={{fn (noop)}}
|
||||
@messageDidLeaveViewport={{fn (noop)}}
|
||||
/>
|
||||
<ChatMessage @message={{this.message}} />
|
||||
`;
|
||||
|
||||
test("Message with edits", async function (assert) {
|
||||
@ -31,7 +27,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-deleted .chat-message-expand"),
|
||||
exists(".chat-message-text.-deleted .chat-message-expand"),
|
||||
"has the correct css class and expand button within"
|
||||
);
|
||||
});
|
||||
@ -41,7 +37,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-hidden .chat-message-expand"),
|
||||
exists(".chat-message-text.-hidden .chat-message-expand"),
|
||||
"has the correct css class and expand button within"
|
||||
);
|
||||
});
|
||||
|
Reference in New Issue
Block a user