Migrate createViewWithBodyClass helper to components

This commit is contained in:
Robin Ward
2016-11-10 13:33:31 -05:00
parent ecb9574a32
commit 0904ad5537
38 changed files with 683 additions and 621 deletions
@@ -4,6 +4,7 @@ acceptance("About");
test("viewing", () => {
visit("/about");
andThen(() => {
ok($('body.about-page').length, "has body class");
ok(exists('.about.admins .user-info'), 'has admins');
ok(exists('.about.moderators .user-info'), 'has moderators');
ok(exists('.about.stats tr td'), 'has stats');
@@ -5,6 +5,7 @@ acceptance("Badges");
test("Visit Badge Pages", () => {
visit("/badges");
andThen(() => {
ok($('body.badges-page').length, "has body class");
ok(exists('.badge-groups .badge-card'), "has a list of badges");
});
@@ -5,6 +5,7 @@ test("update some fields", () => {
visit("/users/eviltrout/preferences");
andThen(() => {
ok($('body.user-preferences-page').length, "has the body class");
equal(currentURL(), '/users/eviltrout/preferences', "it doesn't redirect");
ok(exists('.user-preferences'), 'it shows the preferences');
});
@@ -43,6 +43,8 @@ test("perform various searches", assert => {
visit("/search");
andThen(() => {
ok($('body.search-page').length, "has body class");
ok(exists('.search-container'), "has container class");
assert.ok(find('input.search').length > 0);
assert.ok(find('.fps-topic').length === 0);
});
@@ -0,0 +1,11 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Tags", { loggedIn: true });
test("list the tags", () => {
visit("/tags");
andThen(() => {
ok($('body.tags-page').length, "has the body class");
ok(exists('.tag-eviltrout'), "shows the evil trout tag");
});
});
@@ -4,6 +4,7 @@ acceptance("Topic Discovery");
test("Visit Discovery Pages", () => {
visit("/");
andThen(() => {
ok($('body.navigation-topics').length, "has the default navigation");
ok(exists(".topic-list"), "The list of topics was rendered");
ok(exists('.topic-list .topic-list-item'), "has topics");
});
@@ -24,6 +24,9 @@ test("Root URL", () => {
test("Filters", () => {
visit("/users/eviltrout/activity");
andThen(() => {
ok($('body.user-activity-page').length, "has the body class");
});
hasStream();
visit("/users/eviltrout/activity/topics");
@@ -33,6 +36,14 @@ test("Filters", () => {
hasStream();
});
test("Badges", () => {
visit("/users/eviltrout/badges");
andThen(() => {
ok($('body.user-badges-page').length, "has the body class");
ok(exists(".user-badges-list .badge-card"), "shows a badge");
});
});
test("Restricted Routes", () => {
visit("/users/eviltrout/preferences");
+20 -5
View File
@@ -1,17 +1,32 @@
import { acceptance } from "helpers/qunit-helpers";
import { hasStream } from 'acceptance/user-anonymous-test';
acceptance("User", {loggedIn: true});
test("Pending", () => {
visit("/users/eviltrout/activity/pending");
hasStream();
test("Invites", () => {
visit("/users/eviltrout/invited/pending");
andThen(() => {
ok($('body.user-invites-page').length, "has the body class");
});
});
test("Messages", () => {
visit("/users/eviltrout/messages");
andThen(() => {
ok($('body.user-messages-page').length, "has the body class");
});
});
test("Notifications", () => {
visit("/users/eviltrout/notifications");
andThen(() => {
ok($('body.user-notifications-page').length, "has the body class");
});
});
test("Root URL - Viewing Self", () => {
visit("/users/eviltrout");
andThen(() => {
ok($('body.user-summary-page').length, "has the body class");
equal(currentPath(), 'user.summary', "it defaults to summary");
});
});
@@ -4,6 +4,7 @@ acceptance("User Directory");
test("Visit Page", function() {
visit("/users");
andThen(() => {
ok($('body.users-page').length, "has the body class");
ok(exists('.directory table tr'), "has a list of users");
});
});
@@ -56,6 +56,13 @@ export default function() {
return response(json);
});
this.get('/tags', () => {
return response({ tags: [{
id: 'eviltrout',
count: 1
}] });
});
this.get('/users/eviltrout.json', () => {
const json = fixturesByUrl['/users/eviltrout.json'];
if (loggedIn()) {
@@ -76,6 +83,20 @@ export default function() {
});
});
this.get('/users/eviltrout/invited_count.json', () => {
return response({
"counts": { "pending": 1, "redeemed": 0, "total": 0 }
});
});
this.get('/users/eviltrout/invited.json', () => {
return response({ "invites": [ {id: 1} ] });
});
this.get('/topics/private-messages/eviltrout.json', () => {
return response({ topic_list: { topics: [] } });
});
this.get('/clicks/track', success);
this.get('/search', request => {