mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 00:43:41 +08:00
c34f8b65cb
As of #23867 this is now a real package, so updating the imports to use the real package name, rather than relying on the alias. The name change in the package name is because `I18n` is not a valid name as NPM packages must be all lowercase. This commit also introduces an eslint rule to prevent importing from the old I18n path. For themes/plugins, the old 'i18n' name remains functional.
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
import { render } from "@ember/test-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import I18n from "discourse-i18n";
|
|
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
|
|
|
module(
|
|
"Discourse Chat | 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(hbs`<ChatRetentionReminder @channel={{this.channel}} />`);
|
|
|
|
assert.dom(".chat-retention-reminder").includesText(
|
|
I18n.t("chat.retention_reminders.long", {
|
|
count: this.siteSettings.chat_channel_retention_days,
|
|
})
|
|
);
|
|
});
|
|
|
|
test("@type=short", async function (assert) {
|
|
this.channel = ChatChannel.create({ chatable_type: "Category" });
|
|
this.currentUser.set("needs_channel_retention_reminder", true);
|
|
|
|
await render(
|
|
hbs`<ChatRetentionReminder @channel={{this.channel}} @type="short" />`
|
|
);
|
|
|
|
assert.dom(".chat-retention-reminder").includesText(
|
|
I18n.t("chat.retention_reminders.short", {
|
|
count: this.siteSettings.chat_channel_retention_days,
|
|
})
|
|
);
|
|
});
|
|
}
|
|
);
|