Add acceptance JS tests for group membership button.
This commit is contained in:
parent
a4e7657bbf
commit
389e1d0bd5
|
@ -41,10 +41,6 @@ export default Ember.Component.extend({
|
||||||
this.set('updatingMembership', true);
|
this.set('updatingMembership', true);
|
||||||
const model = this.get('model');
|
const model = this.get('model');
|
||||||
|
|
||||||
if (!!(this.currentUser)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
model.addMembers(this.currentUser.get('username')).then(() => {
|
model.addMembers(this.currentUser.get('username')).then(() => {
|
||||||
model.set('is_group_user', true);
|
model.set('is_group_user', true);
|
||||||
}).catch(popupAjaxError).finally(() => {
|
}).catch(popupAjaxError).finally(() => {
|
||||||
|
|
|
@ -111,7 +111,7 @@ const Group = RestModel.extend({
|
||||||
@observes("visible", "canEveryoneMention")
|
@observes("visible", "canEveryoneMention")
|
||||||
_updateAllowMembershipRequests() {
|
_updateAllowMembershipRequests() {
|
||||||
if (!this.get('visible') || !this.get('canEveryoneMention')) {
|
if (!this.get('visible') || !this.get('canEveryoneMention')) {
|
||||||
this.set('allow_membership_requests', false);
|
this.set ('allow_membership_requests', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,26 @@ test("Browsing Groups", () => {
|
||||||
|
|
||||||
andThen(() => {
|
andThen(() => {
|
||||||
equal(count('.groups-table-row'), 2, 'it displays visible groups');
|
equal(count('.groups-table-row'), 2, 'it displays visible groups');
|
||||||
equal(find('.group-index-join').length, 1, 'it show button to join group');
|
equal(find('.group-index-join').length, 1, 'it shows button to join group');
|
||||||
equal(find('.group-index-request').length, 1, 'it show button to request for group membership');
|
equal(find('.group-index-request').length, 1, 'it shows button to request for group membership');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('.group-index-join');
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
ok(exists('.modal.login-modal'), 'it shows the login modal');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('.login-modal .close');
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
ok(invisible('.modal.login-modal'), 'it closes the login modal');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('.group-index-request');
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
ok(exists('.modal.login-modal'), 'it shows the login modal');
|
||||||
});
|
});
|
||||||
|
|
||||||
click("a[href='/groups/discourse/members']");
|
click("a[href='/groups/discourse/members']");
|
||||||
|
@ -16,6 +34,12 @@ test("Browsing Groups", () => {
|
||||||
andThen(() => {
|
andThen(() => {
|
||||||
equal(find('.group-info-name').text().trim(), 'Awesome Team', "it displays the group page");
|
equal(find('.group-info-name').text().trim(), 'Awesome Team', "it displays the group page");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
click('.group-index-join');
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
ok(exists('.modal.login-modal'), 'it shows the login modal');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Viewing Group", () => {
|
test("Viewing Group", () => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ export default {
|
||||||
"user_count":8,
|
"user_count":8,
|
||||||
"alias_level":0,
|
"alias_level":0,
|
||||||
"visible":true,
|
"visible":true,
|
||||||
|
"public":true,
|
||||||
"flair_url": 'fa-adjust',
|
"flair_url": 'fa-adjust',
|
||||||
"is_group_owner":true
|
"is_group_owner":true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue