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