Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Dec 30, 2025

What

Part of #315.

Adds comprehensive unit tests for the Block V3 React components in assets/src/js/pro/blocks-v3/.

Why

Block V3 components are critical for the Gutenberg block editing experience. These React components handle block rendering, form handling, inline editing, and user interactions. Tests ensure the component behavior is correct and prevent regressions during development.

How

Adding 145 tests across 10 test files:

Test File Component Tests
block-edit.test.js Main block editing component 10
block-edit-error-boundary.test.js Error boundary for block preview 10
block-preview.test.js Block preview rendering 7
block-placeholder.test.js Block placeholder display 9
block-form.test.js SCF fields form handling 19
block-toolbar-fields.test.js Toolbar field controls 21
inline-editing-toolbar.test.js Inline editing features 18
popover-wrapper.test.js Popover with focus management 21
post-locking.test.js WordPress post locking utils 24
jsx-parser.test.js HTML to React/JSX conversion 6

Coverage includes:

  • Component rendering and props handling
  • State management and lifecycle
  • Event handlers and user interactions
  • Error boundary behavior
  • Accessibility features
  • WordPress data store integration
  • JSX parsing and DOM integration

Testing Instructions

Run the test suite:

npm run test:unit -- --testPathPattern="tests/js/blocks-v3"

All 145 tests should pass.

@github-actions
Copy link

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

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

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.86%. Comparing base (fba4d95) to head (572c318).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #331      +/-   ##
============================================
+ Coverage     21.79%   22.86%   +1.07%     
  Complexity     4410     4410              
============================================
  Files           291      291              
  Lines         36940    36940              
============================================
+ Hits           8051     8448     +397     
+ Misses        28889    28492     -397     
Flag Coverage Δ
e2e 28.87% <ø> (ø)
javascript 6.53% <ø> (+3.96%) ⬆️
phpunit 21.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor self-assigned this Dec 30, 2025
@priethor priethor added this to the 6.9.0 milestone Dec 30, 2025
@priethor priethor mentioned this pull request Dec 30, 2025
22 tasks
Part of #315.

Adds comprehensive unit tests for the ACF Block V3 React
components in assets/src/js/pro/blocks-v3/.

New test files (208 tests total):
- block-edit.test.js - Main block editing component (27 tests)
- block-preview.test.js - Block preview rendering (20 tests)
- block-placeholder.test.js - Block placeholder display (26 tests)
- block-form.test.js - ACF fields form handling (19 tests)
- block-toolbar-fields.test.js - Toolbar field controls (24 tests)
- inline-editing-toolbar.test.js - Inline editing features (25 tests)
- popover-wrapper.test.js - Popover with focus management (25 tests)
- post-locking.test.js - WordPress post locking utils (23 tests)
- jsx-parser.test.js - HTML to React/JSX conversion (19 tests)

Coverage includes:
- Component rendering and props handling
- State management and lifecycle
- Event handlers and user interactions
- Error boundary behavior
- Accessibility features
- WordPress data store integration
- XSS risk considerations for JSX parsing
@priethor priethor force-pushed the 1fc1-phase-3-pr-16-bl branch from 8d29570 to 572c318 Compare December 30, 2025 15:29
@priethor priethor merged commit 1e33a3a into trunk Dec 31, 2025
9 checks passed
@priethor priethor deleted the 1fc1-phase-3-pr-16-bl branch December 31, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants