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
Add template title and description on 'get_block_template' hook #44254
Conversation
Hi @gigitux, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
e0ea654
to
9fff6ed
Compare
Test Results SummaryCommit SHA: ef5d508
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
9fff6ed
to
fde3d84
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.
The fix LGTM, and I'm pre-approving this PR.
The only doubt that I have is that the current E2E test runs on TT4. So, even without your fix, the test doesn't fail.
Should we add a theme that overrides the Woo template to cover all the potential cases?
Thanks for the review, @gigitux!
Heads-up that we have a specific workflow named Playwright E2E tests - BlockThemeWithTemplates that runs with a special theme with WooCommerce templates. All files ending with I tried it again, and commenting out L61 causes the tests to fail. You need to run the tests like this:
|
TIL! Cool! At the same time, should we run the tests with both use cases?
This discussion is unrelated to this PR, so feel free to merge it! Great work! 🚀 |
Good question. We do have tests for a block theme that doesn't override WooCommerce templates here. I was on the fence on whether I should add the check I added in this PR to verify template title is shown correctly to these other tests. In fact, I initially did but undid it before committing. 😄 The reason I leaned towards not adding it was that it has never been a bug in block themes without custom templates, so it felt that it was an unnecessary assertion that would pollute the test. But honestly, I still don't have a strong opinion on this, so happy to add it if you think otherwise. |
The main thing is that with E2E tests, we should cover all the possible cases to have good coverage. I don't know if it is possible, but when it makes sense (like in this case), we should run the same test on both configurations because we expect the behavior to be the same. |
Makes sense. In ef5d508 I added the same check to the test that modifies the templates in block themes without custom templates. |
Changes proposed in this Pull Request:
Closes #42221.
This PR adds the template title and description in the
get_block_template
hook, which fixes #42221. I also added some tests to verify there are no regressions in the future and took the opportunity to simplify how we attach the template title and description inadd_block_templates()
.How to test the changes in this Pull Request:
Verify there are no regressions:
Move around the Site Editor freely, keeping an eye on WooCommerce templates titles and descriptions, making sure they always appear correctly.
Verify #42221 is fixed:
Enregistrament.de.pantalla.del.2024-02-01.11-10-29.webm
Changelog entry
Significance
Type
Message
Fix the Site Editor showing the template slug instead of the template title when saving a WooCommerce block template customized by the theme.
Comment