Files
discourse/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
David Taylor 999ae73c78 DEV: [gjs-codemod] apply codemod
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-02 13:44:15 +01:00

45 lines
1.2 KiB
Plaintext

import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import ChatUserInfo from "discourse/plugins/chat/discourse/components/chat-user-info";
module("Discourse Chat | Component | chat-user-info", function (hooks) {
setupRenderingTest(hooks);
test("avatar and name", async function (assert) {
const self = this;
this.set("user", this.currentUser);
await render(<template><ChatUserInfo @user={{self.user}} /></template>);
assert.dom().containsText(this.user.username);
assert.dom().containsText(this.user.name);
});
test("status message", async function (assert) {
const self = this;
this.siteSettings.enable_user_status = true;
this.set("user", this.currentUser);
this.user.setProperties({
status: { description: "happy", emoji: "smile" },
});
await render(
<template>
<ChatUserInfo
@user={{self.user}}
@showStatus={{true}}
@showStatusDescription={{true}}
/>
</template>
);
assert.dom("img.emoji[alt='smile']").exists("it shows the emoji");
assert.dom().containsText("happy");
});
});