discourse/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
Jarek Radosz 893fcf714b
DEV: Remove plugin names from test titles (#39418)
Those are now automatically included in testem's output.
2026-04-21 19:19:52 +02:00

40 lines
1.1 KiB
Text
Vendored

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("Component | chat-user-info", function (hooks) {
setupRenderingTest(hooks);
test("avatar and name", async function (assert) {
this.set("user", this.currentUser);
await render(<template><ChatUserInfo @user={{this.user}} /></template>);
assert.dom().containsText(this.user.username);
assert.dom().containsText(this.user.name);
});
test("status message", async function (assert) {
this.siteSettings.enable_user_status = true;
this.set("user", this.currentUser);
this.user.setProperties({
status: { description: "happy", emoji: "smile" },
});
await render(
<template>
<ChatUserInfo
@user={{this.user}}
@showStatus={{true}}
@showStatusDescription={{true}}
/>
</template>
);
assert.dom("img.emoji[alt='smile']").exists("it shows the emoji");
assert.dom().containsText("happy");
});
});