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

Fix: Theme.json font settings in unit test #56309

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

aaronrobertshaw
Copy link
Contributor

What?

Makes the font settings clearer in the main theme.json test (test_get_stylesheet).

Why?

I couldn't work out if the existing font settings were a mistake or if they were in fact trying to configure font families as if they were font sizes. It's probably best to define both font size and font family configurations for better coverage anyhow.

How?

  • Updates the test's theme.json settings.typography.fontFamilies and introduces settings.typography.fontSizes
  • Updates the expected styles to include matching CSS variable definitions and preset styles.

Testing Instructions

  1. npm run test:unit:php:base -- --filter WP_Theme_JSON_Gutenberg_Test

Screenshots or screencast

Screenshot 2023-11-20 at 11 58 42 am

@aaronrobertshaw aaronrobertshaw self-assigned this Nov 20, 2023
@aaronrobertshaw aaronrobertshaw added [Type] Enhancement A suggestion for improvement. [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Nov 20, 2023
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ phpunit/class-wp-theme-json-test.php

@aaronrobertshaw aaronrobertshaw added [Type] Code Quality Issues or PRs that relate to code quality Needs PHP backport Needs PHP backport to Core and removed [Type] Enhancement A suggestion for improvement. labels Nov 20, 2023
Copy link
Contributor

@glendaviesnz glendaviesnz left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing this.

This change matches the test setup to how a real theme.json will be set up, and the tests still pass when run locally for me.

@glendaviesnz
Copy link
Contributor

Nice tidy-up removing that nesting, I didn't notice that. Tests still passing for me if you want to merge.

@aaronrobertshaw aaronrobertshaw merged commit 272d0a9 into trunk Nov 20, 2023
49 checks passed
@aaronrobertshaw aaronrobertshaw deleted the fix/theme-json-get-stylesheet-font-settings branch November 20, 2023 07:48
@github-actions github-actions bot added this to the Gutenberg 17.2 milestone Nov 20, 2023
@aaronrobertshaw
Copy link
Contributor Author

Backport PR available in: WordPress/wordpress-develop#5942

@youknowriad youknowriad added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Needs PHP backport Needs PHP backport to Core labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants