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