2023-10-11 02:38:59 +08:00
|
|
|
import { render } from "@ember/test-helpers";
|
2023-02-17 21:14:00 +08:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
|
|
|
import { module, test } from "qunit";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
2023-02-17 21:14:00 +08:00
|
|
|
|
|
|
|
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(hbs`<ChatUserInfo @user={{this.user}} />`);
|
|
|
|
|
2023-11-10 18:29:28 +08:00
|
|
|
assert.dom().containsText(this.user.username);
|
|
|
|
assert.dom().containsText(this.user.name);
|
2023-02-17 21:14:00 +08:00
|
|
|
});
|
2024-02-29 17:49:18 +08:00
|
|
|
|
|
|
|
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(
|
|
|
|
hbs`<ChatUserInfo @user={{this.user}} @showStatus={{true}} @showStatusDescription={{true}} />`
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.dom("img.emoji[alt='smile']").exists("it shows the emoji");
|
|
|
|
assert.dom().containsText("happy");
|
|
|
|
});
|
2023-02-17 21:14:00 +08:00
|
|
|
});
|