Skip to content

Add tests for gutenberg_render_layout_support_flag#47719

Merged
tellthemachines merged 1 commit intotrunkfrom
add/layout-tests
Feb 5, 2023
Merged

Add tests for gutenberg_render_layout_support_flag#47719
tellthemachines merged 1 commit intotrunkfrom
add/layout-tests

Conversation

@tellthemachines
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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 ✨

Copy link
Copy Markdown
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 👍

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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