Skip to content

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
@github-actions
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 <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: anton-vlasenko <[email protected]>
Co-authored-by: DAreRodz <[email protected]>

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

@sirreal sirreal requested review from DAreRodz and cbravobernal March 8, 2024 10:41
@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.

@gziolo gziolo requested a review from anton-vlasenko March 8, 2024 10:51
@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
@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.

5 participants