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

Block Support Styles: Add priority param #3158

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Aug 31, 2022

Backport of WordPress/gutenberg#41015.

Needed for the package-sync "dry run" PR: #3154 (comment)

Questions:

cc/ @glendaviesnz @ramonjd for review 😊

Gutenberg tracking issue: WordPress/gutenberg#43440
Trac ticket: https://core.trac.wordpress.org/ticket/56467


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

Thanks @ockham LGTU(s)

@ockham
Copy link
Contributor Author

ockham commented Sep 1, 2022

I've filed a counterpart PR for GB: WordPress/gutenberg#43779

@ockham
Copy link
Contributor Author

ockham commented Sep 1, 2022

I've thought about adding a unit test, but I'm now leaning against, for the following reasons:

  • wp_enqueue_block_support_styles is pretty straight-forward (especially compared to other functions in the same file -- most of which don’t have unit test coverage.) -- It basically just calls add_action().
  • It passes a closure to add_action(). This means we can't really have a test that checks for that closure (e.g. via has_action(), as we can't reference it from outside the function scope.
  • AFAICS, this leaves us with some indirect testing, such as running wp_enqueue_block_support_styles(), and then wp_head() (or wp_footer(), respectively), to see if the CSS that was passed to the function was added to the header (or footer, respectively). However, it's kinda messy to look for that styling inside of the (fairly big) header/footer.
  • Finally, there isn't really any way to test if the $priority was respected -- which is the change we're actually making here.

@desrosj
Copy link
Contributor

desrosj commented Sep 1, 2022

Merged in https://core.trac.wordpress.org/changeset/54048.

@desrosj desrosj closed this Sep 1, 2022
@ockham ockham deleted the add/wp-enqueue-block-styles-priority-param branch September 1, 2022 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants