Add TaskModal component, story, and tests with fixes for test reliabi…#22712
Add TaskModal component, story, and tests with fixes for test reliabi…#22712JorPV merged 17 commits intofeature/task-listfrom
Conversation
Pull Request Test Coverage Report for Build 7bc9d00707c9b16dee562fde9eb845c914e5ffbdDetails
💛 - Coveralls |
- Ensure isOpen prop is typed as boolean for Storybook controls - Update callToAction and detailsList argTypes for clarity - Improve documentation and default args in story - Minor code and doc cleanups
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new TaskModal component to the dashboard-frontend package, including its story and comprehensive test coverage. The component displays task details in a modal dialog with priority indicators, duration estimates, and call-to-action buttons.
- Implements a TaskModal component with supporting Duration, Priority, and CallToActionButton subcomponents
- Adds Storybook documentation and interactive examples
- Includes comprehensive test coverage with snapshot testing
- Adds IntersectionObserver mock to test setup for improved test reliability
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/dashboard-frontend/src/task-list/components/task-modal.js | Main TaskModal component implementation with modal structure and task details display |
| packages/dashboard-frontend/src/task-list/components/call-to-action-button.js | Reusable button component supporting multiple action types (add, delete, link) |
| packages/dashboard-frontend/src/task-list/components/priority.js | Priority indicator component with visual icons for low/medium/high levels |
| packages/dashboard-frontend/src/task-list/components/duration.js | Duration display component showing task time estimates |
| packages/dashboard-frontend/src/icons/HowIcon.js | Custom SVG icon for "how to complete" section |
| packages/dashboard-frontend/src/icons/YoastIcon.js | Yoast brand icon SVG component |
| packages/dashboard-frontend/src/icons/index.js | Icon exports barrel file |
| packages/dashboard-frontend/tests/task-list/task-modal.test.js | Comprehensive test suite for TaskModal component |
| packages/dashboard-frontend/tests/task-list/call-to-action-button.test.js | Test suite with snapshot tests for CallToActionButton |
| packages/dashboard-frontend/tests/setupTests.js | Adds IntersectionObserver mock for test environment |
| packages/dashboard-frontend/stories/task-list/task-modal/task-modal.stories.js | Storybook story with interactive controls |
| packages/dashboard-frontend/stories/task-list/task-modal/documentation.md | Component documentation for Storybook |
| packages/dashboard-frontend/src/index.js | Exports TaskModal for external use |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it( "calls onClose when Close button is clicked", () => { | ||
| const onClose = jest.fn(); | ||
| render( <TaskModal { ...defaultProps } onClose={ onClose } isOpen={ true } /> ); | ||
| const closeButton = screen.getAllByRole( "button" )[ 1 ]; |
There was a problem hiding this comment.
Using array index [1] to select the close button is fragile and could break if button order changes. Consider using a more specific selector like screen.getByText(/Close/i) or adding a test ID to the close button.
| const closeButton = screen.getAllByRole( "button" )[ 1 ]; | |
| const closeButton = screen.getByText( /Close/i ); |
JorPV
left a comment
There was a problem hiding this comment.
Really neat 👍🏼 Just some small findings 🙂
|
CR ✅ AT ✅ |
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
dashboard-frontendpackage.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.Documentation
Quality assurance
Innovation
innovationlabel.Fixes Task list: create task modal component