Skip to content

fix: Expand all now expands subsections #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

vmnavarro94
Copy link
Contributor

@vmnavarro94 vmnavarro94 commented May 19, 2025

Description

It was requested that the Expand All button should expand both Sections and Subsections

  • The state variable is send to the SubSection element so it shares the state controlled by the button

Fixes: openedx/wg-build-test-release#479

  • Now that the SubSections are expanded when clicking in the buttons, the test cases where adapted to handle that behavior.
  • Test cases are adapted to the new behavior.

Testing instructions

  • Got to the Authoring Studio
  • Go to the example course outline
  • Click Expand All

Expected Behavior

  • All Sections and Subsection should be expanded

  • User should be able to expand and collapse all items individually as normal

  • Click Collapse All

Expected Behavior

  • All Sections should be collapsed as normal
  • User should be able to expand and collapse all items individually as normal

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

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label May 19, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @vmnavarro94!

This repository is currently maintained by @bradenmacdonald.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions May 19, 2025
@vmnavarro94 vmnavarro94 force-pushed the fix/issue-479-expand-subsections branch from 8ecbaa7 to 3ed278a Compare May 19, 2025 03:12
@vmnavarro94
Copy link
Contributor Author

Investigating the 2 failing testcases.

@vmnavarro94 vmnavarro94 self-assigned this May 19, 2025
@brian-smith-tcril brian-smith-tcril added the create-sandbox open-craft-grove should create a sandbox environment from this PR label May 19, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions May 22, 2025
@vmnavarro94 vmnavarro94 requested a review from Copilot June 2, 2025 22:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

@vmnavarro94 vmnavarro94 force-pushed the fix/issue-479-expand-subsections branch from 3ed278a to 638a662 Compare June 2, 2025 22:32
@vmnavarro94 vmnavarro94 force-pushed the fix/issue-479-expand-subsections branch from 638a662 to 262ed16 Compare June 2, 2025 23:33
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.01%. Comparing base (cfb4944) to head (262ed16).
Report is 6 commits behind head on master.

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.
📢 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.

@vmnavarro94 vmnavarro94 moved this from Waiting on Author to Ready for Review in Contributions Jun 2, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great! Thank you!

@arbrandes arbrandes merged commit ee7992b into openedx:master Jun 4, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions Jun 4, 2025
@vmnavarro94 vmnavarro94 deleted the fix/issue-479-expand-subsections branch June 4, 2025 16:53
@vmnavarro94 vmnavarro94 restored the fix/issue-479-expand-subsections branch June 5, 2025 01:41
@vmnavarro94 vmnavarro94 deleted the fix/issue-479-expand-subsections branch June 5, 2025 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Expand all button doesn't expand subsection
6 participants