Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#65185 new enhancement

Tests: Add unit tests for wp_color_scheme_settings()

Reported by: pbearne's profile pbearne Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch has-unit-tests
Focuses: tests Cc:

Description

This ticket adds unit tests for the wp_color_scheme_settings() function in wp-admin/includes/misc.php. The tests will verify that the function correctly outputs the color scheme picker and manages the associated scripts and settings for the user profile.

Change History (2)

This ticket was mentioned in PR #11741 on WordPress/wordpress-develop by @pbearne.


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

…sc.php
Description:
This PR adds unit tests for the wp_color_scheme_settings() function in wp-admin/includes/misc.php. These tests ensure that the function correctly outputs the JavaScript configuration for admin color schemes, including appropriate icon color fallbacks when schemes are missing or partially defined.

The tests cover:

  • Successful output of icon colors for a valid user-selected color scheme.
  • Correct fallback to the "modern" color scheme when an invalid scheme is set in user options.
  • Default icon color fallback when neither the current nor the "modern" scheme has defined icon colors.

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

AI Disclosure:

  • AI assistance: Yes
  • Tool(s): Junie (JetBrains)
  • Model(s): gemini-3-flash-preview
  • Used for: Code analysis, test implementation, and workflow management.

#2 @desrosj
5 weeks ago

  • Focuses tests added

Adding the tests focus, which is used to indicate a ticket is solely focused on adding tests.

Note: See TracTickets for help on using tickets.