Skip to content

Tests: Cover _navigation_markup() - #15739

Closed
devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-navigation-markup
Closed

devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-navigation-markup

Conversation

@devmuhib009

@devmuhib009 devmuhib009 commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Description

Adds test coverage for the _navigation_markup() function in src/wp-includes/link-template.php.

The tests cover:

  • Default navigation markup structure, CSS class, aria-label, screen reader text, and links insertion.
  • Custom arguments for CSS class, screen reader heading, and aria-label.
  • Fallback of aria-label to screen reader text when aria-label is empty.
  • The navigation_markup_template filter receiving both template and CSS class arguments.
  • Sanitization of CSS classes via sanitize_html_class().

Test-only change.

Testing Instructions

npm run test:php -- --filter Tests_Link_NavigationMarkup
npm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Link_NavigationMarkup
vendor/bin/phpcs tests/phpunit/tests/link/navigationMarkup.php

Trac ticket:
https://core.trac.wordpress.org/ticket/66757
https://core.trac.wordpress.org/ticket/66612

See #65819.
Props devmuhib009.
@github-actions

github-actions Bot commented Nov 6, 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 working on this, @devmuhib009! The test cases look clean and well-structured.

Just a quick reminder: per the new guideline from Lance Willett in #65819 comment 1521, test-only changes should now have their own dedicated Trac tickets opened under the component of the code under test rather than using #65819.

For _navigation_markup() in src/wp-includes/link-template.php, the most suitable component is Posts, Post Types (or Template).

Could you please:

  1. Open a new Trac ticket in Posts, Post Types (or Template) with the has-patch and has-unit-tests keywords and link this PR.
  2. Update the Trac ticket: reference in this PR's description to the new ticket.
  3. Update the @ticket 65819 annotations in navigationMarkup.php to reflect the new ticket number.

AI Review: Gemini 3.8 Flash

See #66612.
Props devmuhib009.
wporg-sync pushed a commit that referenced this pull request Nov 26, 2026
Verify:
- Default navigation markup structure, CSS class, aria-label, screen reader text, and links insertion.
- Custom arguments for CSS class, screen reader heading, and `aria-label`.
- Fallback of `aria-label` to screen reader text when empty.
- The `navigation_markup_template` filter receiving both template and CSS class arguments.
- Sanitization of CSS classes via `sanitize_html_class()`.

Developed in #15739.

Props devmuhib, huzaifaalmesbah.
See #66757.

git-svn-id: https://develop.svn.wordpress.org/trunk@65805 602fd350-edb4-49c9-b593-d223f7449a82
@SergeyBiryukov

Copy link
Copy Markdown
Member

Thanks for the PR! Merged in r65805.

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 26, 2026
Verify:
- Default navigation markup structure, CSS class, aria-label, screen reader text, and links insertion.
- Custom arguments for CSS class, screen reader heading, and `aria-label`.
- Fallback of `aria-label` to screen reader text when empty.
- The `navigation_markup_template` filter receiving both template and CSS class arguments.
- Sanitization of CSS classes via `sanitize_html_class()`.

Developed in WordPress/wordpress-develop#15739.

Props devmuhib, huzaifaalmesbah.
See #66757.
Built from https://develop.svn.wordpress.org/trunk@65805


git-svn-id: http://core.svn.wordpress.org/trunk@64834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

3 participants