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

Make editor.getBlocks to return only testing-related properties #54901

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

kevin940726
Copy link
Member

What?

As suggested by @ellatrix in a private conversation some time ago, we probably don't need getBlocks to return clientId and other properties for testing purposes.

A recent encounter is #54892 (comment).

Why?

This is going to make editor.getBlocks slightly more helpful in some situations that we can just compare using toEqual rather than having to get rid of clientId first.

How?

Recursively transform the blocks before returning. A full option can be passed if the users want to retain the previous behavior.

Another idea would be to allow comparing blocks with consideration of the default attributes' values. That would be probably be better suited in a different PR though.

Testing Instructions

CI should pass.

Testing Instructions for Keyboard

N/A

Screenshots or screencast

N/A

@kevin940726 kevin940726 added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Sep 28, 2023
@kevin940726 kevin940726 self-assigned this Sep 28, 2023
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

It's a nice improvement and makes sense.

@kevin940726 kevin940726 merged commit 61cc83f into trunk Sep 28, 2023
53 checks passed
@kevin940726 kevin940726 deleted the fix/get-blocks-properties branch September 28, 2023 08:44
@github-actions github-actions bot added this to the Gutenberg 16.8 milestone Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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