discourse/test/javascripts/acceptance/user-anonymous-test.js.es6

55 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-04-21 14:36:46 -04:00
import { acceptance } from "helpers/qunit-helpers";
acceptance("User Anonymous");
export function hasStream() {
andThen(() => {
ok(exists('.user-main .about'), 'it has the about section');
ok(count('.user-stream .item') > 0, 'it has stream items');
});
}
function hasTopicList() {
andThen(() => {
equal(count('.user-stream .item'), 0, "has no stream displayed");
ok(count('.topic-list tr') > 0, 'it has a topic list');
});
}
test("Root URL", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout");
andThen(() => {
ok($('body.user-summary-page').length, "has the body class");
2017-03-07 12:36:31 -05:00
equal(currentPath(), 'user.summary', "it defaults to summary");
});
});
test("Filters", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity");
andThen(() => {
ok($('body.user-activity-page').length, "has the body class");
});
hasStream();
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity/topics");
hasTopicList();
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity/replies");
hasStream();
});
test("Badges", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/badges");
andThen(() => {
ok($('body.user-badges-page').length, "has the body class");
ok(exists(".user-badges-list .badge-card"), "shows a badge");
});
});
test("Restricted Routes", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/preferences");
andThen(() => {
equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences");
});
});