2017-03-14 11:44:52 +08:00
|
|
|
import { acceptance, logIn } from "helpers/qunit-helpers";
|
2016-12-13 15:15:20 +08:00
|
|
|
|
2017-03-14 11:44:52 +08:00
|
|
|
acceptance("Editing Group");
|
2016-12-13 15:15:20 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Editing group", assert => {
|
2017-03-14 11:44:52 +08:00
|
|
|
logIn();
|
|
|
|
Discourse.reset();
|
|
|
|
|
2016-12-13 15:15:20 +08:00
|
|
|
visit("/groups/discourse/edit");
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
|
|
|
|
assert.ok(find('.group-edit-bio').length === 1, 'it should display group bio input');
|
|
|
|
assert.ok(find('.group-edit-full-name').length === 1, 'it should display group full name input');
|
2017-07-28 10:37:10 +08:00
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
find('.group-edit-public-admission').length === 1,
|
|
|
|
'it should display group public admission input'
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
find('.group-edit-public-exit').length === 1,
|
|
|
|
'it should display group public exit input'
|
|
|
|
);
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(find('.group-edit-allow-membership-requests').length === 1, 'it should display group allow_membership_requets input');
|
|
|
|
assert.ok(find('.group-members-input .item').length === 7, 'it should display group members');
|
|
|
|
assert.ok(find('.group-members-input-selector').length === 1, 'it should display input to add group members');
|
|
|
|
assert.ok(find('.group-members-input-selector .add[disabled]').length === 1, 'add members button should be disabled');
|
2016-12-13 15:15:20 +08:00
|
|
|
|
2017-07-28 10:37:10 +08:00
|
|
|
assert.ok(
|
|
|
|
find('.group-edit-allow-membership-requests[disabled]').length === 1,
|
|
|
|
'it should disable group allow_membership_request input'
|
|
|
|
);
|
2016-12-13 15:15:20 +08:00
|
|
|
});
|
|
|
|
|
2017-07-28 10:37:10 +08:00
|
|
|
click('.group-edit-public-admission');
|
2016-12-13 15:15:20 +08:00
|
|
|
click('.group-edit-allow-membership-requests');
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-07-28 10:37:10 +08:00
|
|
|
assert.ok(
|
|
|
|
find('.group-edit-public-admission[disabled]').length === 1,
|
|
|
|
'it should disable group public admission input'
|
|
|
|
);
|
2017-08-08 17:53:02 +08:00
|
|
|
|
2017-11-06 10:30:58 +08:00
|
|
|
assert.ok(
|
|
|
|
find('.group-edit-public-exit[disabled]').length === 0,
|
|
|
|
'it should not disable group public exit input'
|
|
|
|
);
|
|
|
|
|
2017-08-08 17:53:02 +08:00
|
|
|
assert.equal(
|
|
|
|
find('.group-edit-membership-request-template').length, 1,
|
|
|
|
'it should display the membership request template field'
|
|
|
|
);
|
2016-12-13 15:15:20 +08:00
|
|
|
});
|
|
|
|
});
|
2017-03-14 11:44:52 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Editing group as an anonymous user", assert => {
|
2017-03-14 11:44:52 +08:00
|
|
|
visit("/groups/discourse/edit");
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(count('.group-members tr') > 0, "it should redirect to members page for an anonymous user");
|
2017-03-14 11:44:52 +08:00
|
|
|
});
|
2017-07-28 10:37:10 +08:00
|
|
|
});
|