Skip to content
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

Component: Extract getNodeText to its own file and add unit tests #69135

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

im3dabasia
Copy link
Contributor

Related PR: #54902
Related Issue: #55495

What?

Closes: #55495
Extracts getNodeText into its own file, adds unit tests, and refactors unused code.

Why?

The original implementation was merged quickly to address an accessibility issue (#47767). This PR improves maintainability by isolating the function, adding tests, and removing unnecessary code.

How?

  • Moved getNodeText to a separate file.
  • Added unit tests to verify expected behavior.
  • Removed redundant or unused code from the function.

Testing Instructions

Run the following command to execute unit tests for getNodeText:

npm run test:unit packages/components/src/utils/test/get-node-text.js

Screenshots or screencast

image

@im3dabasia im3dabasia marked this pull request as ready for review February 11, 2025 06:56
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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @sreeragdas, @oceantober.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: sreeragdas, oceantober.

Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: alexstine <[email protected]>
Co-authored-by: jeryj <[email protected]>

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

@im3dabasia
Copy link
Contributor Author

Hey @Mamaduka ,

When you have a moment please review my PR.

Thank you

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract getNodeText and add Unit Tests
2 participants