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-07-19 06:11:18 -04:00
|
|
|
QUnit.test("As an admin", async assert => {
|
2018-03-27 00:18:03 -04:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-07-19 06:11:18 -04:00
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
find(".group-flair-inputs").length === 1,
|
|
|
|
"it should display avatar flair inputs"
|
|
|
|
);
|
|
|
|
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-04-05 23:36:57 -04:00
|
|
|
});
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("As a group owner", async assert => {
|
2018-04-05 23:36:57 -04:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
replaceCurrentUser({ staff: false, admin: false });
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
assert.equal(
|
|
|
|
find(".group-form-name").length,
|
|
|
|
0,
|
|
|
|
"it should not display group name input"
|
|
|
|
);
|
2018-03-27 00:18:03 -04:00
|
|
|
});
|
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("As an anonymous user", async assert => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g/discourse/manage/profile");
|
2018-03-27 00:18:03 -04:00
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
assert.ok(
|
|
|
|
count(".group-members tr") > 0,
|
|
|
|
"it should redirect to members page for an anonymous user"
|
|
|
|
);
|
2018-03-27 00:18:03 -04:00
|
|
|
});
|