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

Use viewScriptModule block.json field for interactivity e2e tests #59705

Merged
merged 2 commits into from Mar 11, 2024

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Mar 8, 2024

What?

Use viewScriptModule to for assets in the interactivity end-to-end test plugin.

Why?

The interactivity end-to-end test blocks were manually registering and enqueuing view modules.
They also erroneously included (unregistered) viewScript handles.

viewScriptModule is a clean and simple way to handle registration and enqueue for these assets.

How?

  • Update block.json to change "viewScript": "…" to `"viewScriptModule": "file:./view.js"
  • Add corresponding view.asset.php files.
  • Remove manual enqueue from render.php files.

Testing Instructions

The e2e tests should continue to pass.

@sirreal sirreal added [Type] Code Quality Issues or PRs that relate to code quality [Package] E2E Tests /packages/e2e-tests [Feature] Interactivity API API to add frontend interactivity to blocks. labels Mar 8, 2024
Copy link

github-actions bot commented Mar 8, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org>
Co-authored-by: DAreRodz <darerodz@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sirreal

This comment was marked as resolved.

@sirreal
Copy link
Member Author

sirreal commented Mar 8, 2024

I think I've fixed or ignored the lints correctly.

phpcs.xml.dist Outdated Show resolved Hide resolved
phpcs.xml.dist Outdated Show resolved Hide resolved
@gziolo
Copy link
Member

gziolo commented Mar 8, 2024

Nice refactoring, I don't know the codebase so I will leave the approval to more experienced folks 👍🏻

Copy link
Contributor

@DAreRodz DAreRodz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactor is neat. Thank you, @sirreal! 👏

@sirreal sirreal force-pushed the update/use-viewscriptmodule-in-interactivity-e2e branch from c7bad45 to d7329fd Compare March 11, 2024 15:04
@sirreal sirreal enabled auto-merge (squash) March 11, 2024 15:13
@sirreal sirreal disabled auto-merge March 11, 2024 15:13
@sirreal sirreal enabled auto-merge (squash) March 11, 2024 15:13
@sirreal sirreal merged commit a80f2f7 into trunk Mar 11, 2024
56 checks passed
@sirreal sirreal deleted the update/use-viewscriptmodule-in-interactivity-e2e branch March 11, 2024 15:36
@github-actions github-actions bot added this to the Gutenberg 18.0 milestone Mar 11, 2024
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Mar 27, 2024
…rdPress#59705)

The interactivity end-to-end test blocks were manually registering and enqueuing view modules.
They also erroneously included (unregistered) viewScript handles.

viewScriptModule is a clean and simple way to handle registration and enqueue for these assets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Package] E2E Tests /packages/e2e-tests [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants