-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Comment Template Block: Add test coverage for context setting #50879
Comment Template Block: Add test coverage for context setting #50879
Conversation
Flaky tests detected in e4c1ff7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5058441320
|
d09ba37
to
4ab65a5
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this test covering special case for the Comment Template block. It was very helpful to see the PR targeting WordPress Core to confrim that setup code is only duplicated to run it in the Gutenberg repo.
Have you considered adding an additional assertion to verify whether the $comment_author_name_block
variable is non-empty string or has some shape at all. It would cover the case when the block would stop rendering any output, but it might be covered with other tests. So it isn't a blocker, but something for you to decide.
Ah yeah, sounds like a great idea! I'll add something. |
…ess#50879) Add a unit test to verify that the Comment Template block sets `commentId` context as expected.
What?
Add a unit test to verify that the Comment Template block sets
commentId
context as expected. Follow up to #50279; see #50279 (comment) for context.Why?
Conversation on #50279 indicates that it's fairly easy to make a change to the relevant code which would break this behavior. Consequently, it makes sense to guard against such breakage.
How?
By inserting a block which requires
commentId
context to work via therender_block
hook.Testing Instructions
npm run test:unit:php -- --group=blocks
.npm run build
). Re-run the test, and verify that it fails now.Note
In the long run, this test should be merged into
wordpress-develop
'srenderCommentTemplate.php
test file.