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
|
|
|
|
});
|
|
|
|
|
2020-07-09 15:54:53 -04:00
|
|
|
QUnit.test("when disabled", async function(assert) {
|
|
|
|
this.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"
|
|
|
|
);
|
2020-07-09 15:54:53 -04:00
|
|
|
});
|
2019-03-18 11:26:18 -04:00
|
|
|
|
2020-07-09 15:54:53 -04:00
|
|
|
QUnit.test("when enabled", async function(assert) {
|
|
|
|
this.siteSettings.disable_emails = "yes";
|
2019-03-18 13:06:29 -04:00
|
|
|
await visit("/latest");
|
|
|
|
assert.ok(
|
2019-03-18 11:26:18 -04:00
|
|
|
exists(".alert-emails-disabled"),
|
|
|
|
"alert is displayed when email disabled"
|
|
|
|
);
|
2020-07-09 15:54:53 -04:00
|
|
|
});
|
2019-03-18 11:26:18 -04:00
|
|
|
|
2020-07-09 15:54:53 -04:00
|
|
|
QUnit.test("when non-staff", async function(assert) {
|
|
|
|
this.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
|
|
|
});
|