2015-04-22 02:36:46 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("User Anonymous");
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
function hasStream(assert) {
|
2015-04-22 02:36:46 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".user-main .about"), "it has the about section");
|
|
|
|
assert.ok(count(".user-stream .item") > 0, "it has stream items");
|
2015-04-22 02:36:46 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
function hasTopicList(assert) {
|
2016-08-03 01:21:06 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(count(".user-stream .item"), 0, "has no stream displayed");
|
|
|
|
assert.ok(count(".topic-list tr") > 0, "it has a topic list");
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Root URL", assert => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout");
|
2016-08-03 01:21:06 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok($("body.user-summary-page").length, "has the body class");
|
|
|
|
assert.equal(currentPath(), "user.summary", "it defaults to summary");
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Filters", assert => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity");
|
2016-11-11 02:33:31 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok($("body.user-activity-page").length, "has the body class");
|
2016-11-11 02:33:31 +08:00
|
|
|
});
|
2017-06-15 01:57:58 +08:00
|
|
|
hasStream(assert);
|
2016-08-03 01:21:06 +08:00
|
|
|
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity/topics");
|
2017-06-15 01:57:58 +08:00
|
|
|
hasTopicList(assert);
|
2016-08-03 01:21:06 +08:00
|
|
|
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/activity/replies");
|
2017-06-15 01:57:58 +08:00
|
|
|
hasStream(assert);
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Badges", assert => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/badges");
|
2016-11-11 02:33:31 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok($("body.user-badges-page").length, "has the body class");
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists(".user-badges-list .badge-card"), "shows a badge");
|
2016-11-11 02:33:31 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Restricted Routes", assert => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences");
|
2016-08-03 01:21:06 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
"/u/eviltrout/activity",
|
|
|
|
"it redirects from preferences"
|
|
|
|
);
|
2016-08-03 01:21:06 +08:00
|
|
|
});
|
|
|
|
});
|