mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +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,87 @@
|
||||
import { set } from "@ember/object";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
||||
import { module } from "qunit";
|
||||
|
||||
module(
|
||||
"Discourse Chat | Component | chat-composer placeholder",
|
||||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("direct message to self shows Jot something down", {
|
||||
template: hbs`{{chat-composer chatChannel=chatChannel}}`,
|
||||
|
||||
beforeEach() {
|
||||
set(this.currentUser, "id", 1);
|
||||
this.set(
|
||||
"chatChannel",
|
||||
ChatChannel.create({
|
||||
chatable_type: "DirectMessageChannel",
|
||||
chatable: {
|
||||
users: [{ id: 1 }],
|
||||
},
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
query(".chat-composer-input").placeholder,
|
||||
"Jot something down"
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("direct message to multiple folks shows their names", {
|
||||
template: hbs`{{chat-composer chatChannel=chatChannel}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set(
|
||||
"chatChannel",
|
||||
ChatChannel.create({
|
||||
chatable_type: "DirectMessageChannel",
|
||||
chatable: {
|
||||
users: [
|
||||
{ name: "Tomtom" },
|
||||
{ name: "Steaky" },
|
||||
{ username: "zorro" },
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
query(".chat-composer-input").placeholder,
|
||||
"Chat with Tomtom, Steaky, @zorro"
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("message to channel shows send message to channel name", {
|
||||
template: hbs`{{chat-composer chatChannel=chatChannel}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set(
|
||||
"chatChannel",
|
||||
ChatChannel.create({
|
||||
chatable_type: "Category",
|
||||
title: "just-cats",
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
query(".chat-composer-input").placeholder,
|
||||
"Chat with #just-cats"
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user