2015-04-10 17:00:50 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
acceptance("Queued Posts", { loggedIn: true });
|
|
|
|
|
|
|
|
test("approve a post", () => {
|
|
|
|
visit("/queued-posts");
|
|
|
|
|
2015-04-15 17:20:34 -04:00
|
|
|
click('.queued-post:eq(0) button.approve');
|
2015-04-10 17:00:50 -04:00
|
|
|
andThen(() => {
|
2015-04-15 17:20:34 -04:00
|
|
|
ok(!exists('.queued-post'), 'it removes the post');
|
2015-04-10 17:00:50 -04:00
|
|
|
});
|
2015-04-15 17:20:34 -04:00
|
|
|
});
|
2015-04-10 17:00:50 -04:00
|
|
|
|
2015-04-15 17:20:34 -04:00
|
|
|
test("reject a post", () => {
|
|
|
|
visit("/queued-posts");
|
|
|
|
|
|
|
|
click('.queued-post:eq(0) button.reject');
|
2015-04-10 17:00:50 -04:00
|
|
|
andThen(() => {
|
|
|
|
ok(!exists('.queued-post'), 'it removes the post');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-04-15 17:20:34 -04:00
|
|
|
test("edit a post - cancel", () => {
|
2015-04-10 17:00:50 -04:00
|
|
|
visit("/queued-posts");
|
|
|
|
|
2015-04-15 17:20:34 -04:00
|
|
|
click('.queued-post:eq(0) button.edit');
|
2015-04-10 17:00:50 -04:00
|
|
|
andThen(() => {
|
2015-04-15 17:20:34 -04:00
|
|
|
equal(find('.queued-post:eq(0) textarea').val(), 'queued post text', 'it shows an editor');
|
2015-04-10 17:00:50 -04:00
|
|
|
});
|
|
|
|
|
2015-04-15 17:20:34 -04:00
|
|
|
fillIn('.queued-post:eq(0) textarea', 'new post text');
|
|
|
|
click('.queued-post:eq(0) button.cancel');
|
2015-04-10 17:00:50 -04:00
|
|
|
andThen(() => {
|
2015-04-15 17:20:34 -04:00
|
|
|
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');
|
2015-04-10 17:00:50 -04:00
|
|
|
});
|
|
|
|
});
|