discourse/test/javascripts/acceptance/group-manage-profile-test.js
jbrw aa1fc01307
FEATURE - Moderators can create and manage groups (#10432)
Enabling the moderators_manage_categories_and_groups site setting will allow moderator users to create/manage groups.

* show New Group form to moderators

* Allow moderators to update groups and read logs, where appropriate

* Rename site setting from create -> manage

* improved tests

* Migration should rename old log entries

* Log group changes, even if those changes mean you can no longer see the group

* Slight reshuffle

* RouteTo /g if they no longer have permissions to view group
2020-08-19 10:41:40 -04:00

51 lines
1.2 KiB
JavaScript

import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
acceptance("Managing Group Profile");
QUnit.test("As an anonymous user", async assert => {
await visit("/g/discourse/manage/profile");
assert.ok(
count(".group-members tr") > 0,
"it should redirect to members page for an anonymous user"
);
});
acceptance("Managing Group Profile", { loggedIn: true });
QUnit.test("As an admin", async assert => {
await visit("/g/discourse/manage/profile");
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"
);
});
QUnit.test("As a group owner", async assert => {
updateCurrentUser({
moderator: false,
admin: false,
can_create_group: false
});
await visit("/g/discourse/manage/profile");
assert.equal(
find(".group-form-name").length,
0,
"it should not display group name input"
);
});