Tests: Add Jest unit tests for Block V3 React components#331
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
8d29570 to
572c318
Compare
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:
block-edit.test.jsblock-edit-error-boundary.test.jsblock-preview.test.jsblock-placeholder.test.jsblock-form.test.jsblock-toolbar-fields.test.jsinline-editing-toolbar.test.jspopover-wrapper.test.jspost-locking.test.jsjsx-parser.test.jsCoverage includes:
Testing Instructions
Run the test suite:
npm run test:unit -- --testPathPattern="tests/js/blocks-v3"All 145 tests should pass.