mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 22:50:31 +08:00
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
40 lines
1.2 KiB
Text
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");
|
|
});
|
|
});
|