Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent multiple custom fields from being created #591

Merged
merged 3 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/editorial-comments/editorial-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function add_admin_scripts( ) {
if ( !in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'page-new.php' ) ) )
return;

wp_enqueue_script( 'edit_flow-post_comment', $this->module_url . 'lib/editorial-comments.js', array( 'jquery','post' ), EDIT_FLOW_VERSION, true );
wp_enqueue_script( 'edit_flow-post_comment', $this->module_url . 'lib/editorial-comments.js', array( 'jquery', 'wp-ajax-response' ), EDIT_FLOW_VERSION, true );
wp_localize_script( 'edit_flow-post_comment', '__ef_localize_post_comment', array(
'and' => esc_html__( 'and', 'edit-flow' ),
'none_notified' => esc_html__( 'No one will be notified.', 'edit-flow' ),
Expand Down
35 changes: 35 additions & 0 deletions tests/e2e/specs/editorial-comments.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* WordPress dependencies
*/

import { createNewPost, saveDraft } from "@wordpress/e2e-test-utils";

describe("Editorial Comments", () => {

it("expects a user can create an editorial comment on a post", async () => {
await createNewPost({title: 'Title'});
await saveDraft();

// todo: Eventually, we should show the "Respond to post" button when a post is saved in Gutenberg
// without having to reload the page
await page.reload({ waitUntil: ["networkidle0", "domcontentloaded"] });

const COMMENT_TEXT = 'Hello';

const respondButton = await page.$('#ef-comment_respond');
await respondButton.click();

await page.type('#ef-replycontent', COMMENT_TEXT);

const saveReplyButton = await page.$('.ef-replysave');
await saveReplyButton.click();

const commentNodes = await page.waitFor('#ef-comments .comment-content');

const comments = await commentNodes.$$eval('p', nodes => nodes.map(n => {
return n.innerText
}));

expect(comments).toContain(COMMENT_TEXT);
});
});