discourse/test/javascripts/acceptance/group-index-test.js.es6

64 lines
1.5 KiB
Plaintext
Raw Normal View History

import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers";
acceptance("Group Members");
QUnit.test("Viewing Members as anon user", assert => {
visit("/groups/discourse");
andThen(() => {
2018-06-15 11:03:24 -04:00
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(
2018-06-15 11:03:24 -04:00
count(".group-member-dropdown") === 0,
"it does not allow anon user to manage group members"
);
assert.equal(
2018-06-15 11:03:24 -04:00
find(".group-username-filter").attr("placeholder"),
I18n.t("groups.members.filter_placeholder"),
"it should display the right filter placehodler"
);
});
});
QUnit.test("Viewing Members as a group owner", assert => {
logIn();
Discourse.reset();
replaceCurrentUser({ admin: false, staff: false });
visit("/groups/discourse");
2018-06-15 11:03:24 -04:00
click(".group-members-add");
andThen(() => {
assert.equal(
2018-06-15 11:03:24 -04:00
find("#group-add-members-user-selector").length,
1,
"it should display the add members modal"
);
});
});
QUnit.test("Viewing Members as an admin user", assert => {
logIn();
Discourse.reset();
visit("/groups/discourse");
andThen(() => {
assert.ok(
2018-06-15 11:03:24 -04:00
count(".group-member-dropdown") > 0,
"it allows admin user to manage group members"
);
assert.equal(
2018-06-15 11:03:24 -04:00
find(".group-username-filter").attr("placeholder"),
I18n.t("groups.members.filter_placeholder_admin"),
"it should display the right filter placehodler"
);
});
});