fix: Expand all now expands subsections - #1998
Conversation
|
Thanks for the pull request, @vmnavarro94! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
8ecbaa7 to
3ed278a
Compare
|
Investigating the 2 failing testcases. |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
There was a problem hiding this comment.
Pull Request Overview
This PR implements a fix so that the "Expand All" button now expands both sections and their subsections. The key changes include:
- Updating the SubsectionCard component to derive its expanded state from a new prop (isSectionsExpanded) via its initial state and a useEffect hook.
- Adjusting test cases in CourseOutline.test.jsx by removing manual expansion button clicks that are no longer necessary due to the new global expansion behavior.
- Propagating the isSectionsExpanded flag from CourseOutline to SubsectionCard.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/course-outline/subsection-card/SubsectionCard.jsx | Updated to use the isSectionsExpanded prop to control expansion state with added useEffect hook and PropTypes update. |
| src/course-outline/CourseOutline.test.jsx | Modified tests to remove redundant manual expansion clicks in favor of the new global expansion state. |
| src/course-outline/CourseOutline.jsx | Passed the isSectionsExpanded prop to SubsectionCard to support the new behavior. |
Comments suppressed due to low confidence (1)
src/course-outline/CourseOutline.test.jsx:2069
- [nitpick] Since expansion is now managed via the isSectionsExpanded prop, consider removing or updating this test to avoid simulating a click that is no longer required.
const expandBtn = await within(subsectionElement).findByTestId('subsection-card-header__expanded-btn');
fireEvent.click(expandBtn);
3ed278a to
638a662
Compare
638a662 to
262ed16
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1998 +/- ##
========================================
Coverage 94.01% 94.01%
========================================
Files 1154 1154
Lines 24185 24187 +2
Branches 5118 5223 +105
========================================
+ Hits 22737 22740 +3
+ Misses 1380 1379 -1
Partials 68 68 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
arbrandes
left a comment
There was a problem hiding this comment.
Looks and works great! Thank you!
Description
It was requested that the Expand All button should expand both Sections and Subsections
Fixes: openedx/wg-build-test-release#479
Testing instructions
Expand AllExpected Behavior
All Sections and Subsection should be expanded
User should be able to expand and collapse all items individually as normal
Click
Collapse AllExpected Behavior
Before
Screen.Recording.2025-05-18.at.7.44.05.p.m.mov
After
Screen.Recording.2025-05-18.at.7.45.07.p.m.mov