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

Add tests for gutenberg_render_layout_support_flag #47719

Merged
merged 1 commit into from
Feb 5, 2023

Conversation

tellthemachines
Copy link
Contributor

What?

Adding some unit tests for gutenberg_render_layout_support_flag because it didn't have any.

  • Test that correct base classnames are output for two layout types on a single-wrapper block;
  • Test that base classname is added to inner wrapper on multi-wrapper block.

Testing Instructions

Check out the branch and run npm run test:unit:php .

Testing Instructions for Keyboard

Screenshots or screencast

@tellthemachines tellthemachines self-assigned this Feb 3, 2023
@tellthemachines tellthemachines added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Feature] Layout Layout block support, its UI controls, and style output. labels Feb 3, 2023
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Flaky tests detected in 75aa876.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4081235988
📝 Reported issues:

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for adding in these tests @tellthemachines, great idea testing to make sure the main container class is output correctly! 🎉

The tests are running well for me locally, I noticed that the Github action PHP tests are failing, but it's tag processor tests that are failing, so I assume this is a potential conflict between Gutenberg trunk and wordpress-develop rather than anything in this PR. Once that's resolved (separately to this PR), and this is rebased, it looks like this will be in good shape to land to me ✨

),
'expected_output' => '<div class="wp-block-group is-layout-constrained"></div>',
),
'multiple wrapper block layout with flow type' => array(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea making sure the inner wrapper logic works 👍

public function data_layout_support_flag_renders_classnames_on_wrapper() {
return array(
'single wrapper block layout with flow type' => array(
'args' => array(
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good to me, but I was wondering if there's a code style preference between placing the params in a nested args array or moving them one level up to be at the root of the array (and therefore become their own params on test_layout_support_flag_renders_classnames_on_wrapper)? So far I haven't been nesting them further in data providers, but it does look like a good way to keep the params contained 👍

In short: this was just a comment, not anything that needs changing IMO 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this from the get_layout_style tests as it felt like a nice way to structure it! Not sure how widespread one or the other approach is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes, of course! Let's leave it as is, looks nice to me, too, I'll probably borrow it next time I'm writing a data provider 🙂

@andrewserong
Copy link
Contributor

I noticed that the Github action PHP tests are failing

Just to close the loop, the failing PHP tests should be resolved by: #47720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants