-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 and inner block insertion #4507
Comment Template Block: Add test coverage for context setting and inner block insertion #4507
Conversation
Note that the |
af0ffd9
to
ddf8439
Compare
Added tests from WordPress/gutenberg#50883. |
Hi 👋 |
@tellthemachines Apologies, I still haven't gotten around to do this. Upon second thought, I think I should split the PR in two, one of which we should be able to merge before Beta 1 (when blocks are synced from GB), whereas the other test will only pass after that sync. I'll try to take care of that splitting, plus filing the required tickets, early next week. (Then again, none of this is super-urgent, so it's not the end of the world if it doesn't go into 6.3.) |
Thanks for the update @ockham ! |
9c1457c
to
c9485df
Compare
Rebased to pick up the updated packages and to make tests pass 🤞 Wondering if we should consider including these with 6.3 after all, given https://core.trac.wordpress.org/ticket/58699. (The tests wouldn't have caught that, but they provide some confidence that we don't introduce any regressions when fixing that. This might be a bit more academic here, since the fix has to be made in GB anyway, where those tests are already in place.) |
I'm not against adding more test coverage 😄 Is this ready for review then? Asking because it's still in draft mode. |
Ah yep, I guess it is -- apologies 😅 I guess I wasn't 100% sure if the tests were "minimal" enough (especially |
c9485df
to
5cc94a3
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.
These tests are generally looking good to add to me. Just left a question about the remove_filter
and add_filter
calls for Gutenberg filters. I imagine those can be removed? I couldn't find gutenberg_auto_insert_child_block
in the Gutenberg repo, but I might be missing some context there potentially.
Ah, great spot! Yep, they can be removed; I'll take care of that. Thank you for flagging 👍 😄 |
return $inserted_content . $block_content; | ||
}; | ||
|
||
add_filter( 'render_block', $render_block_callback, 10, 3 ); |
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.
No need to store the callback, just pass it directly here. The test suite cleans up all filters after each test, so no need to call remove_filter()
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.
Oh, you mean like inline? Cool, will do 👍
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.
Took me a while, but I’ve filed the ticket. I've also addressed everyone's feedback (thank you!) We're pretty close to RC1, so I'm not sure if folks are comfortable merging this so late in the game. OTOH, it's a test-only change that's supposed to guard against regressions 🤔 |
Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
756caa6
to
ec9a7ae
Compare
…_context filter at priority 2
Added some more coverage in d3e3ffd to cover the scenario fixed by WordPress/gutenberg#52364. cc/ @dlh01 |
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
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.
Just some nit feedback, but with these and @mukeshpanchal27's suggestions, this looks good to go. Thanks @ockham!
Pre-approving so as not to hold up commit as my internet is tempramental today.
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Thanks all! Committed to Core in https://core.trac.wordpress.org/changeset/56262 😊 |
Backport of WordPress/gutenberg#50879 and WordPress/gutenberg#50883.
Trac ticket: https://core.trac.wordpress.org/ticket/58839
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.