2018-04-16 09:09:47 +08:00
|
|
|
import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers";
|
2018-03-21 18:16:08 +08:00
|
|
|
|
|
|
|
acceptance("Group Members");
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
QUnit.test("Viewing Members as anon user", async assert => {
|
|
|
|
await visit("/groups/discourse");
|
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
count(".avatar-flair .fa-adjust") === 1,
|
|
|
|
"it displays the group's avatar flair"
|
|
|
|
);
|
|
|
|
assert.ok(count(".group-members tr") > 0, "it lists group members");
|
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
count(".group-member-dropdown") === 0,
|
|
|
|
"it does not allow anon user to manage group members"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
find(".group-username-filter").attr("placeholder"),
|
|
|
|
I18n.t("groups.members.filter_placeholder"),
|
|
|
|
"it should display the right filter placehodler"
|
|
|
|
);
|
2018-03-21 18:16:08 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
QUnit.test("Viewing Members as a group owner", async assert => {
|
2018-04-16 09:09:47 +08:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
replaceCurrentUser({ admin: false, staff: false });
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
await visit("/groups/discourse");
|
|
|
|
await click(".group-members-add");
|
2018-04-16 09:09:47 +08:00
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
assert.equal(
|
|
|
|
find("#group-add-members-user-selector").length,
|
|
|
|
1,
|
|
|
|
"it should display the add members modal"
|
|
|
|
);
|
2018-04-16 09:09:47 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
QUnit.test("Viewing Members as an admin user", async assert => {
|
2018-03-21 18:16:08 +08:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
await visit("/groups/discourse");
|
2018-03-21 18:16:08 +08:00
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
assert.ok(
|
|
|
|
count(".group-member-dropdown") > 0,
|
|
|
|
"it allows admin user to manage group members"
|
|
|
|
);
|
2018-03-22 13:42:46 +08:00
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
assert.equal(
|
|
|
|
find(".group-username-filter").attr("placeholder"),
|
|
|
|
I18n.t("groups.members.filter_placeholder_admin"),
|
|
|
|
"it should display the right filter placehodler"
|
|
|
|
);
|
2018-03-21 18:16:08 +08:00
|
|
|
});
|