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

55 lines
1.4 KiB
Plaintext
Raw Normal View History

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) {
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');
});
}
2017-06-14 13:57:58 -04:00
QUnit.test("Root URL", assert => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout");
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");
});
});
2017-06-14 13:57:58 -04:00
QUnit.test("Filters", assert => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity");
andThen(() => {
2017-06-14 13:57:58 -04:00
assert.ok($('body.user-activity-page').length, "has the body class");
});
2017-06-14 13:57:58 -04:00
hasStream(assert);
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity/topics");
2017-06-14 13:57:58 -04:00
hasTopicList(assert);
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/activity/replies");
2017-06-14 13:57:58 -04:00
hasStream(assert);
});
2017-06-14 13:57:58 -04:00
QUnit.test("Badges", assert => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/badges");
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");
});
});
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");
andThen(() => {
2017-06-14 13:57:58 -04:00
assert.equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences");
});
});