mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 11:03:48 +08:00
60c67afba4
- Improves styleguide support - Adds toggle color scheme to styleguide - Adds properties mutators to styleguide - Attempts to quit a session as soon as done with it in system specs, this should at least free resources faster - Refactors fabricators to simplify them - Adds more fabricators (uploads for example) - Starts implementing components pattern in system specs - Uses Chat::Message creator to create messages in system specs, this should help to have more real specs as the side effects should now happen
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
|
import { module, test } from "qunit";
|
|
import { render } from "@ember/test-helpers";
|
|
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
|
|
|
module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("chat_webhook_event", async function (assert) {
|
|
this.message = ChatMessage.create(fabricators.channel(), {
|
|
chat_webhook_event: { emoji: ":heart:" },
|
|
});
|
|
|
|
await render(hbs`<ChatMessageAvatar @message={{this.message}} />`);
|
|
|
|
assert.strictEqual(query(".chat-emoji-avatar .emoji").title, "heart");
|
|
});
|
|
|
|
test("user", async function (assert) {
|
|
this.message = ChatMessage.create(fabricators.channel(), {
|
|
user: { username: "discobot" },
|
|
});
|
|
|
|
await render(hbs`<ChatMessageAvatar @message={{this.message}} />`);
|
|
|
|
assert.true(exists('.chat-user-avatar [data-user-card="discobot"]'));
|
|
});
|
|
});
|