mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
Enables our new eslint rules which enforce consistent i18n imports. For more info, see https://github.com/discourse/lint-configs/commit/0d58b40cd7d170a9f70bcef5c173f95eeb498298
57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
import { visit } from "@ember/test-helpers";
|
|
import { test } from "qunit";
|
|
import {
|
|
acceptance,
|
|
updateCurrentUser,
|
|
} from "discourse/tests/helpers/qunit-helpers";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
acceptance("Email Disabled Banner", function (needs) {
|
|
needs.user();
|
|
|
|
test("when disabled", async function (assert) {
|
|
this.siteSettings.disable_emails = "no";
|
|
await visit("/");
|
|
assert
|
|
.dom(".alert-emails-disabled")
|
|
.doesNotExist("alert is not displayed when email enabled");
|
|
});
|
|
|
|
test("when enabled", async function (assert) {
|
|
this.siteSettings.disable_emails = "yes";
|
|
await visit("/latest");
|
|
assert
|
|
.dom(".alert-emails-disabled")
|
|
.exists("alert is displayed when email disabled");
|
|
assert
|
|
.dom(".alert-emails-disabled .text")
|
|
.hasText(i18n("emails_are_disabled"), "alert uses the correct text");
|
|
});
|
|
|
|
test("when non-staff", async function (assert) {
|
|
this.siteSettings.disable_emails = "non-staff";
|
|
await visit("/");
|
|
assert
|
|
.dom(".alert-emails-disabled")
|
|
.exists("alert is displayed when email disabled for non-staff");
|
|
assert
|
|
.dom(".alert-emails-disabled .text")
|
|
.hasText(
|
|
i18n("emails_are_disabled_non_staff"),
|
|
"alert uses the correct text"
|
|
);
|
|
|
|
updateCurrentUser({ moderator: true });
|
|
await visit("/");
|
|
assert
|
|
.dom(".alert-emails-disabled")
|
|
.exists("alert is displayed to staff when email disabled for non-staff");
|
|
assert
|
|
.dom(".alert-emails-disabled .text")
|
|
.hasText(
|
|
i18n("emails_are_disabled_non_staff"),
|
|
"alert uses the correct text"
|
|
);
|
|
});
|
|
});
|