2019-06-14 20:54:20 +08:00
|
|
|
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
2019-03-18 23:26:18 +08:00
|
|
|
|
|
|
|
acceptance("Email Disabled Banner", {
|
|
|
|
loggedIn: true
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("shows banner when required", async assert => {
|
2019-03-19 01:06:29 +08:00
|
|
|
Discourse.set("SiteSettings.disable_emails", "no");
|
2019-03-18 23:26:18 +08:00
|
|
|
await visit("/");
|
|
|
|
assert.notOk(
|
|
|
|
exists(".alert-emails-disabled"),
|
|
|
|
"alert is not displayed when email enabled"
|
|
|
|
);
|
|
|
|
|
2019-03-19 01:06:29 +08:00
|
|
|
Discourse.set("SiteSettings.disable_emails", "yes");
|
|
|
|
await visit("/latest");
|
|
|
|
assert.ok(
|
2019-03-18 23:26:18 +08:00
|
|
|
exists(".alert-emails-disabled"),
|
|
|
|
"alert is displayed when email disabled"
|
|
|
|
);
|
|
|
|
|
2019-03-19 01:06:29 +08:00
|
|
|
Discourse.set("SiteSettings.disable_emails", "non-staff");
|
2019-03-18 23:26:18 +08:00
|
|
|
await visit("/");
|
2019-03-19 01:06:29 +08:00
|
|
|
assert.ok(
|
2019-03-18 23:26:18 +08:00
|
|
|
exists(".alert-emails-disabled"),
|
|
|
|
"alert is displayed when email disabled for non-staff"
|
|
|
|
);
|
2019-03-19 01:06:29 +08:00
|
|
|
|
2019-06-14 20:54:20 +08:00
|
|
|
updateCurrentUser({ staff: true, moderator: true });
|
2019-03-19 01:06:29 +08:00
|
|
|
await visit("/");
|
|
|
|
assert.ok(
|
|
|
|
exists(".alert-emails-disabled"),
|
|
|
|
"alert is displayed to staff when email disabled for non-staff"
|
|
|
|
);
|
2019-03-18 23:26:18 +08:00
|
|
|
});
|