Skip to content

Tests: Cover wp_get_tooltip_helper() - #15794

Open
devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-wp-get-tooltip-helper
Open

devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-wp-get-tooltip-helper

Conversation

@devmuhib009

@devmuhib009 devmuhib009 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Description

Adds unit tests for the wp_get_tooltip_helper() function in src/wp-includes/general-template.php.

The tests cover:

  • Returning an empty string when content is empty or whitespace only.
  • Default tooltip markup structure, including the button toggle, Dashicon, popover hint, and tooltip role.
  • Generating toggletip markup with proper popovertarget and aria-haspopup="dialog".
  • Using custom button markup processed with WP_HTML_Tag_Processor.
  • Applying custom classes, element IDs, and Dashicon icons.

Test-only change.

Testing Instructions

npm run test:php -- --filter Tests_General_WpGetTooltipHelper
npm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_General_WpGetTooltipHelper
vendor/bin/phpcs tests/phpunit/tests/general/wpGetTooltipHelper.php

Trac ticket: https://core.trac.wordpress.org/ticket/66618

See #65819.
Props devmuhib009.
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props devmuhib, huzaifaalmesbah.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@huzaifaalmesbah huzaifaalmesbah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the patch, @devmuhib009! Great coverage for wp_get_tooltip_helper() testing tooltip markup, dashicons, and aria labels.

Per #65819 comment 1521, test-only changes now need their own Trac ticket in the component of the code under test rather than using #65819.

For wp_get_tooltip_helper() in src/wp-includes/general-template.php, the component is General (or Accessibility).

Could you please:

  1. Open a dedicated Trac ticket under General (or Accessibility) with has-patch and has-unit-tests keywords and link this PR.
  2. Update the Trac ticket: URL in this PR's description.
  3. Update the @ticket 65819 annotations in wpGetTooltipHelper.php with the new ticket ID.

AI Review: Gemini 3.8 Flash

See #66618.
Props devmuhib009.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants