2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00
discourse/test/javascripts/acceptance/groups-test.js.es6

58 lines
2 KiB
Text
Raw Normal View History

import { acceptance, logIn } from "helpers/qunit-helpers";
acceptance("Groups");
test("Browsing Groups", () => {
visit("/groups/discourse");
andThen(() => {
ok(count('.avatar-flair .fa-adjust') === 1, "it displays the group's avatar flair");
2016-06-02 18:51:43 +05:30
ok(count('.group-members tr') > 0, "it lists group members");
});
2016-06-02 18:51:43 +05:30
visit("/groups/discourse/posts");
andThen(() => {
2016-06-02 18:51:43 +05:30
ok(count('.user-stream .item') > 0, "it lists stream items");
});
visit("/groups/discourse/topics");
andThen(() => {
ok(count('.user-stream .item') > 0, "it lists stream items");
});
visit("/groups/discourse/mentions");
andThen(() => {
ok(count('.user-stream .item') > 0, "it lists stream items");
});
visit("/groups/discourse/messages");
andThen(() => {
2016-12-12 17:31:47 +08:00
ok(find(".nav-stacked li a[title='Messages']").length === 0, 'it should not show messages tab if user is admin');
ok(find(".nav-stacked li a[title='Logs']").length === 0, 'it should not show Logs tab if user is admin');
ok(count('.user-stream .item') > 0, "it lists stream items");
});
});
test("Admin Browsing Groups", () => {
logIn();
Discourse.reset();
visit("/groups/discourse");
andThen(() => {
2016-12-11 23:36:15 +08:00
ok(find(".nav-stacked li a[title='Messages']").length === 1, 'it should show messages tab if user is admin');
ok(find(".nav-stacked li a[title='Logs']").length === 1, 'it should show Logs tab if user is admin');
2016-12-07 10:20:13 +08:00
equal(find('.group-title').text(), 'Awesome Team', 'it should display the group title');
equal(find('.group-name').text(), '@discourse', 'it should display the group name');
});
click('.group-edit-btn');
andThen(() => {
ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
2016-12-05 16:18:24 +08:00
ok(find('.edit-group-bio').length === 1, 'it should display group bio input');
ok(find('.edit-group-title').length === 1, 'it should display group title input');
2016-12-07 12:06:56 +08:00
ok(find('.edit-group-public').length === 1, 'it should display group public input');
});
});