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