2015-04-22 02:36:46 +08: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');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-08-03 01:21:06 +08:00
|
|
|
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-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout");
|
2016-08-03 01:21:06 +08:00
|
|
|
andThen(() => {
|
2017-03-21 02:14:50 +08:00
|
|
|
ok($('body.user-summary-page').length, "has the body class");
|
2017-03-08 01:36:31 +08:00
|
|
|
equal(currentPath(), 'user.summary', "it defaults to summary");
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Filters", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity");
|
2016-11-11 02:33:31 +08:00
|
|
|
andThen(() => {
|
|
|
|
ok($('body.user-activity-page').length, "has the body class");
|
|
|
|
});
|
2016-08-03 01:21:06 +08:00
|
|
|
hasStream();
|
|
|
|
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity/topics");
|
2016-08-03 01:21:06 +08:00
|
|
|
hasTopicList();
|
|
|
|
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity/replies");
|
2016-08-03 01:21:06 +08:00
|
|
|
hasStream();
|
|
|
|
});
|
|
|
|
|
2016-11-11 02:33:31 +08:00
|
|
|
test("Badges", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/badges");
|
2016-11-11 02:33:31 +08:00
|
|
|
andThen(() => {
|
|
|
|
ok($('body.user-badges-page').length, "has the body class");
|
|
|
|
ok(exists(".user-badges-list .badge-card"), "shows a badge");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-08-03 01:21:06 +08:00
|
|
|
test("Restricted Routes", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences");
|
2016-08-03 01:21:06 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-03-28 03:34:54 +08:00
|
|
|
equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences");
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
});
|