mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Move discourse-chat
to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
This commit is contained in:
@ -0,0 +1,55 @@
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module } from "qunit";
|
||||
|
||||
const user = {
|
||||
id: 1,
|
||||
username: "markvanlan",
|
||||
name: null,
|
||||
avatar_template: "/letter_avatar_proxy/v4/letter/m/48db29/{size}.png",
|
||||
};
|
||||
|
||||
module("Discourse Chat | Component | chat-user-avatar", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("user is not online", {
|
||||
template: hbs`{{chat-user-avatar chat=chat user=user}}`,
|
||||
|
||||
async beforeEach() {
|
||||
this.set("user", user);
|
||||
this.set("chat", { presenceChannel: { users: [] } });
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(
|
||||
exists(
|
||||
`.chat-user-avatar .chat-user-avatar-container[data-user-card=${user.username}] .avatar[title=${user.username}]`
|
||||
)
|
||||
);
|
||||
assert.notOk(exists(".chat-user-avatar.is-online"));
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("user is online", {
|
||||
template: hbs`{{chat-user-avatar chat=chat user=user}}`,
|
||||
|
||||
async beforeEach() {
|
||||
this.set("user", user);
|
||||
this.set("chat", {
|
||||
presenceChannel: { users: [{ id: user.id }] },
|
||||
});
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(
|
||||
exists(
|
||||
`.chat-user-avatar .chat-user-avatar-container[data-user-card=${user.username}] .avatar[title=${user.username}]`
|
||||
)
|
||||
);
|
||||
assert.ok(exists(".chat-user-avatar.is-online"));
|
||||
},
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user