mirror of
https://github.com/discourse/discourse.git
synced 2024-12-28 14:35:56 +08:00
038e5deb2a
* `@ember/owner` instead of `@ember/application` * `discourse-i18n` instead of `I18n` * `{ service } from "@ember/service"` instead of `inject as service`
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import { getOwner } from "@ember/owner";
|
|
import { render } from "@ember/test-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
|
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
|
|
|
module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("chat_webhook_event", async function (assert) {
|
|
this.message = ChatMessage.create(
|
|
new ChatFabricators(getOwner(this)).channel(),
|
|
{
|
|
chat_webhook_event: { emoji: ":heart:" },
|
|
}
|
|
);
|
|
|
|
await render(hbs`<Chat::Message::Avatar @message={{this.message}} />`);
|
|
|
|
assert.strictEqual(query(".chat-emoji-avatar .emoji").title, "heart");
|
|
});
|
|
|
|
test("user", async function (assert) {
|
|
this.message = ChatMessage.create(
|
|
new ChatFabricators(getOwner(this)).channel(),
|
|
{
|
|
user: { username: "discobot" },
|
|
}
|
|
);
|
|
|
|
await render(hbs`<Chat::Message::Avatar @message={{this.message}} />`);
|
|
|
|
assert.true(exists('.chat-user-avatar [data-user-card="discobot"]'));
|
|
});
|
|
});
|