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