mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 19:53:42 +08:00
This was required in older versions of Ember. But now, bare template tags can access `this.`. This commit was created by upgrading lint-configs, and then running `pnpm lint:js:fix && pnpm lint:prettier:fix` Rule development: https://github.com/discourse/lint-configs/pull/154
37 lines
1.3 KiB
Text
37 lines
1.3 KiB
Text
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 Avatar from "discourse/plugins/chat/discourse/components/chat/message/avatar";
|
|
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(<template><Avatar @message={{this.message}} /></template>);
|
|
|
|
assert.dom(".chat-emoji-avatar .emoji").hasAttribute("title", "heart");
|
|
});
|
|
|
|
test("user", async function (assert) {
|
|
this.message = ChatMessage.create(
|
|
new ChatFabricators(getOwner(this)).channel(),
|
|
{
|
|
user: { username: "discobot" },
|
|
}
|
|
);
|
|
|
|
await render(<template><Avatar @message={{this.message}} /></template>);
|
|
|
|
assert.dom('.chat-user-avatar [data-user-card="discobot"]').exists();
|
|
});
|
|
});
|