mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 00:13:44 +08:00
dc3473fe06
1. `test()` and `render()` instead of `componentTest()` 2. Angle brackets 3. `strictEqual()`/`true()`/`false()` assertions This removes all remaining uses of `componentTest` from core
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import I18n from "I18n";
|
|
import { module, test } from "qunit";
|
|
import { render } from "@ember/test-helpers";
|
|
|
|
module("Discourse Chat | Component | chat-message-separator", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("newest message", async function (assert) {
|
|
this.set("message", { newestMessage: true });
|
|
|
|
await render(hbs`<ChatMessageSeparator @message={{this.message}} />`);
|
|
|
|
assert.strictEqual(
|
|
query(".chat-message-separator.new-message .text").innerText.trim(),
|
|
I18n.t("chat.new_messages")
|
|
);
|
|
});
|
|
|
|
test("first message of the day", async function (assert) {
|
|
this.set("date", moment().format("LLL"));
|
|
this.set("message", { firstMessageOfTheDayAt: this.date });
|
|
|
|
await render(hbs`<ChatMessageSeparator @message={{this.message}} />`);
|
|
|
|
assert.strictEqual(
|
|
query(
|
|
".chat-message-separator.first-daily-message .text"
|
|
).innerText.trim(),
|
|
this.date
|
|
);
|
|
});
|
|
});
|