discourse/plugins/chat/test/javascripts/components/chat-message-avatar-test.js
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

35 lines
957 B
JavaScript

import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
import hbs from "htmlbars-inline-precompile";
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
import { module } from "qunit";
module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
setupRenderingTest(hooks);
componentTest("chat_webhook_event", {
template: hbs`{{chat-message-avatar message=message}}`,
beforeEach() {
this.set("message", { chat_webhook_event: { emoji: ":heart:" } });
},
async test(assert) {
assert.equal(query(".chat-emoji-avatar .emoji").title, "heart");
},
});
componentTest("user", {
template: hbs`{{chat-message-avatar message=message}}`,
beforeEach() {
this.set("message", { user: { username: "discobot" } });
},
async test(assert) {
assert.ok(exists('.chat-user-avatar [data-user-card="discobot"]'));
},
});
});