mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:51:05 +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,76 @@
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { module } from "qunit";
|
||||
|
||||
module("Discourse Chat | Component | chat-message-text", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("yields", {
|
||||
template: hbs`{{#chat-message-text cooked=cooked uploads=uploads}} <div class="yield-me"></div> {{/chat-message-text}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("cooked", "<p></p>");
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(exists(".yield-me"));
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("shows collapsed", {
|
||||
template: hbs`{{chat-message-text cooked=cooked uploads=uploads}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set(
|
||||
"cooked",
|
||||
'<div class="onebox lazyYT lazyYT-container" data-youtube-id="WaT_rLGuUr8" data-youtube-title="Japanese Katsu Curry (Pork Cutlet)"/>'
|
||||
);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(exists(".chat-message-collapser"));
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("does not collapse a non-image onebox", {
|
||||
template: hbs`{{chat-message-text cooked=cooked}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set(
|
||||
"cooked",
|
||||
'<p><a href="http://cat1.com" class="onebox"></a></p>'
|
||||
);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.notOk(exists(".chat-message-collapser"));
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("shows edits - regular message", {
|
||||
template: hbs`{{chat-message-text cooked=cooked edited=true}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("cooked", "<p></p>");
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(exists(".chat-message-edited"));
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("shows edits - collapsible message", {
|
||||
template: hbs`{{chat-message-text cooked=cooked edited=true}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("cooked", '<div class="onebox lazyYT-container"></div>');
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(exists(".chat-message-edited"));
|
||||
},
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user