mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 02:41:20 +08:00
42 lines
1.4 KiB
Text
Vendored
42 lines
1.4 KiB
Text
Vendored
import { render } from "@ember/test-helpers";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { i18n } from "discourse-i18n";
|
|
import ChatRetentionReminder from "discourse/plugins/chat/discourse/components/chat-retention-reminder";
|
|
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
|
|
|
module("Component | chat-retention-reminder", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("display retention info", async function (assert) {
|
|
this.channel = ChatChannel.create({ chatable_type: "Category" });
|
|
this.currentUser.set("needs_channel_retention_reminder", true);
|
|
|
|
await render(
|
|
<template><ChatRetentionReminder @channel={{this.channel}} /></template>
|
|
);
|
|
|
|
assert
|
|
.dom(".chat-retention-reminder")
|
|
.includesText(
|
|
`retain channel messages for ${this.siteSettings.chat_channel_retention_days} days`
|
|
);
|
|
});
|
|
|
|
test("@type=short", async function (assert) {
|
|
this.channel = ChatChannel.create({ chatable_type: "Category" });
|
|
this.currentUser.set("needs_channel_retention_reminder", true);
|
|
|
|
await render(
|
|
<template>
|
|
<ChatRetentionReminder @channel={{this.channel}} @type="short" />
|
|
</template>
|
|
);
|
|
|
|
assert.dom(".chat-retention-reminder").includesText(
|
|
i18n("chat.retention_reminders.short", {
|
|
count: this.siteSettings.chat_channel_retention_days,
|
|
})
|
|
);
|
|
});
|
|
});
|