2018-04-06 11:36:57 +08:00
|
|
|
import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers";
|
2018-03-27 12:18:03 +08:00
|
|
|
|
|
|
|
acceptance("Managing Group Profile");
|
|
|
|
|
2018-04-06 11:36:57 +08:00
|
|
|
QUnit.test("As an admin", assert => {
|
2018-03-27 12:18:03 +08:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
|
|
|
|
visit("/groups/discourse/manage/profile");
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
|
2018-03-27 18:59:21 +08:00
|
|
|
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-03-27 12:18:03 +08:00
|
|
|
});
|
2018-04-06 11:36:57 +08:00
|
|
|
});
|
2018-03-27 12:18:03 +08:00
|
|
|
|
2018-04-06 11:36:57 +08:00
|
|
|
QUnit.test("As a group owner", assert => {
|
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
replaceCurrentUser({ staff: false, admin: false });
|
2018-03-27 12:18:03 +08:00
|
|
|
|
2018-04-06 11:36:57 +08:00
|
|
|
visit("/groups/discourse/manage/profile");
|
2018-03-27 12:18:03 +08:00
|
|
|
|
2018-04-06 11:36:57 +08:00
|
|
|
andThen(() => {
|
2018-03-27 12:18:03 +08:00
|
|
|
assert.equal(
|
2018-04-06 11:36:57 +08:00
|
|
|
find('.group-form-name').length, 0,
|
|
|
|
'it should not display group name input'
|
2018-03-27 12:18:03 +08:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-04-06 11:36:57 +08:00
|
|
|
QUnit.test("As an anonymous user", assert => {
|
2018-03-27 12:18:03 +08:00
|
|
|
visit("/groups/discourse/manage/profile");
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(count('.group-members tr') > 0, "it should redirect to members page for an anonymous user");
|
|
|
|
});
|
|
|
|
});
|