2019-06-14 08:54:20 -04:00
|
|
|
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
2018-03-27 00:18:03 -04:00
|
|
|
|
|
|
|
acceptance("Managing Group Profile");
|
2019-06-14 08:54:20 -04:00
|
|
|
QUnit.test("As an anonymous user", async (assert) => {
|
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2019-06-14 08:54:20 -04:00
|
|
|
assert.ok(
|
|
|
|
count(".group-members tr") > 0,
|
|
|
|
"it should redirect to members page for an anonymous user"
|
|
|
|
);
|
|
|
|
});
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2019-06-14 08:54:20 -04:00
|
|
|
acceptance("Managing Group Profile", { loggedIn: true });
|
|
|
|
|
|
|
|
QUnit.test("As an admin", async (assert) => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-07-19 06:11:18 -04:00
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
find(".group-flair-inputs").length === 1,
|
|
|
|
"it should display avatar flair inputs"
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
find(".group-form-bio").length === 1,
|
|
|
|
"it should display group bio input"
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
find(".group-form-name").length === 1,
|
|
|
|
"it should display group name input"
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
find(".group-form-full-name").length === 1,
|
|
|
|
"it should display group full name input"
|
|
|
|
);
|
2018-04-05 23:36:57 -04:00
|
|
|
});
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("As a group owner", async (assert) => {
|
2020-08-19 10:41:40 -04:00
|
|
|
updateCurrentUser({
|
|
|
|
moderator: false,
|
|
|
|
admin: false,
|
|
|
|
can_create_group: false,
|
|
|
|
});
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
assert.equal(
|
|
|
|
find(".group-form-name").length,
|
|
|
|
0,
|
|
|
|
"it should not display group name input"
|
|
|
|
);
|
2018-03-27 00:18:03 -04:00
|
|
|
});
|