discourse/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
David Taylor 9322a46fa4
DEV: Remove unneeded const self = this; from qunit tests (#35632)
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
2025-10-27 18:07:22 +00:00

40 lines
1.2 KiB
Text

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) {
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");
});
});