2020-05-14 10:04:08 -04:00
|
|
|
import I18n from "I18n";
|
2019-06-14 08:54:20 -04:00
|
|
|
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
2018-03-21 06:16:08 -04:00
|
|
|
|
|
|
|
acceptance("Group Members");
|
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("Viewing Members as anon user", async assert => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse");
|
2018-07-19 06:11:18 -04:00
|
|
|
|
|
|
|
assert.ok(
|
2018-11-26 16:49:57 -05:00
|
|
|
count(".avatar-flair .d-icon-adjust") === 1,
|
2018-07-19 06:11:18 -04:00
|
|
|
"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 06:16:08 -04:00
|
|
|
});
|
|
|
|
|
2019-06-14 08:54:20 -04:00
|
|
|
acceptance("Group Members", { loggedIn: true });
|
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("Viewing Members as a group owner", async assert => {
|
2019-07-24 16:01:08 -04:00
|
|
|
updateCurrentUser({ moderator: false, admin: false });
|
2018-04-15 21:09:47 -04:00
|
|
|
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse");
|
2018-07-19 06:11:18 -04:00
|
|
|
await click(".group-members-add");
|
2018-04-15 21:09:47 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
assert.equal(
|
|
|
|
find("#group-add-members-user-selector").length,
|
|
|
|
1,
|
|
|
|
"it should display the add members modal"
|
|
|
|
);
|
2018-04-15 21:09:47 -04:00
|
|
|
});
|
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("Viewing Members as an admin user", async assert => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse");
|
2018-03-21 06:16:08 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
assert.ok(
|
|
|
|
count(".group-member-dropdown") > 0,
|
|
|
|
"it allows admin user to manage group members"
|
|
|
|
);
|
2018-03-22 01:42:46 -04:00
|
|
|
|
2018-07-19 06:11:18 -04: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 06:16:08 -04:00
|
|
|
});
|