2015-04-21 14:36:46 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("User Anonymous");
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
function hasStream(assert) {
|
2015-04-21 14:36:46 -04:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04: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-21 14:36:46 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
function hasTopicList(assert) {
|
2016-08-02 13:21:06 -04:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04: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-02 13:21:06 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("Root URL", assert => {
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout");
|
2016-08-02 13:21:06 -04:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok($('body.user-summary-page').length, "has the body class");
|
|
|
|
assert.equal(currentPath(), 'user.summary', "it defaults to summary");
|
2016-08-02 13:21:06 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("Filters", assert => {
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout/activity");
|
2016-11-10 13:33:31 -05:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok($('body.user-activity-page').length, "has the body class");
|
2016-11-10 13:33:31 -05:00
|
|
|
});
|
2017-06-14 13:57:58 -04:00
|
|
|
hasStream(assert);
|
2016-08-02 13:21:06 -04:00
|
|
|
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout/activity/topics");
|
2017-06-14 13:57:58 -04:00
|
|
|
hasTopicList(assert);
|
2016-08-02 13:21:06 -04:00
|
|
|
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout/activity/replies");
|
2017-06-14 13:57:58 -04:00
|
|
|
hasStream(assert);
|
2016-08-02 13:21:06 -04:00
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("Badges", assert => {
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout/badges");
|
2016-11-10 13:33:31 -05:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok($('body.user-badges-page').length, "has the body class");
|
|
|
|
assert.ok(exists(".user-badges-list .badge-card"), "shows a badge");
|
2016-11-10 13:33:31 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("Restricted Routes", assert => {
|
2017-03-28 14:27:54 -04:00
|
|
|
visit("/u/eviltrout/preferences");
|
2016-08-02 13:21:06 -04:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences");
|
2016-08-02 13:21:06 -04:00
|
|
|
});
|
|
|
|
});
|