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

59 lines
1.5 KiB
Plaintext
Raw Normal View History

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