Moderators can edit posts that are queued before they approve/reject

This commit is contained in:
Robin Ward
2015-04-15 17:20:34 -04:00
parent 2303b1dcd0
commit 08b4b7b7ff
8 changed files with 134 additions and 47 deletions
@@ -5,10 +5,6 @@ acceptance("Queued Posts", { loggedIn: true });
test("approve a post", () => {
visit("/queued-posts");
andThen(() => {
ok(exists('.queued-post'), 'it has posts listed');
});
click('.queued-post:eq(0) button.approve');
andThen(() => {
ok(!exists('.queued-post'), 'it removes the post');
@@ -18,12 +14,40 @@ test("approve a post", () => {
test("reject a post", () => {
visit("/queued-posts");
andThen(() => {
ok(exists('.queued-post'), 'it has posts listed');
});
click('.queued-post:eq(0) button.reject');
andThen(() => {
ok(!exists('.queued-post'), 'it removes the post');
});
});
test("edit a post - cancel", () => {
visit("/queued-posts");
click('.queued-post:eq(0) button.edit');
andThen(() => {
equal(find('.queued-post:eq(0) textarea').val(), 'queued post text', 'it shows an editor');
});
fillIn('.queued-post:eq(0) textarea', 'new post text');
click('.queued-post:eq(0) button.cancel');
andThen(() => {
ok(!exists('textarea'), 'it disables editing');
equal(find('.queued-post:eq(0) .body p').text(), 'queued post text', 'it reverts the new text');
});
});
test("edit a post - confirm", () => {
visit("/queued-posts");
click('.queued-post:eq(0) button.edit');
andThen(() => {
equal(find('.queued-post:eq(0) textarea').val(), 'queued post text', 'it shows an editor');
});
fillIn('.queued-post:eq(0) textarea', 'new post text');
click('.queued-post:eq(0) button.confirm');
andThen(() => {
ok(!exists('textarea'), 'it disables editing');
equal(find('.queued-post:eq(0) .body p').text(), 'new post text', 'it has the new text');
});
});
@@ -104,7 +104,7 @@ export default function() {
this.get('/queued_posts', function() {
return response({
queued_posts: [{id: 1}]
queued_posts: [{id: 1, raw: 'queued post text'}]
});
});