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 end 2 end test to block switcher with removed blocks #12323

Merged

Conversation

jorgefilipecosta
Copy link
Member

Description

This PR's adds tests that make sure the block switcher works correctly even when some blocks are removed.
This test changes should catch the bug fixed in #12192.

How has this been tested?

Verify the end 2 end tests pass.
Apply the following patch the reverts
#12192 and verify the end 2 end tests fail:

diff --git a/packages/editor/src/components/block-switcher/index.js b/packages/editor/src/components/block-switcher/index.js
index adc4bf4ef..390e6a7f3 100644
--- a/packages/editor/src/components/block-switcher/index.js
+++ b/packages/editor/src/components/block-switcher/index.js
@@ -47,7 +47,7 @@ export class BlockSwitcher extends Component {
 		const possibleBlockTransformations = orderBy(
 			filter(
 				getPossibleBlockTransformations( blocks ),
-				( block ) => block && !! itemsByName[ block.name ]
+				( block ) => !! itemsByName[ block.name ]
 			),
 			( block ) => itemsByName[ block.name ].frecency,
 			'desc'

@jorgefilipecosta jorgefilipecosta added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Nov 26, 2018
@jorgefilipecosta jorgefilipecosta changed the title Add end 2 end test block switcher removed blocks Add end 2 end test block switcher withremoved blocks Nov 26, 2018
@jorgefilipecosta jorgefilipecosta force-pushed the add/end2end-test-block-switcher-removed-blocks branch from 16f70f1 to 30151e3 Compare November 26, 2018 17:28
@jorgefilipecosta jorgefilipecosta changed the title Add end 2 end test block switcher withremoved blocks Add end 2 end test block switcher with removed blocks Nov 26, 2018
@jorgefilipecosta jorgefilipecosta changed the title Add end 2 end test block switcher with removed blocks Add end 2 end test to block switcher with removed blocks Nov 26, 2018
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

@jorgefilipecosta jorgefilipecosta merged commit 9cc1e49 into master Nov 27, 2018
@jorgefilipecosta jorgefilipecosta deleted the add/end2end-test-block-switcher-removed-blocks branch November 27, 2018 19:22
@jorgefilipecosta
Copy link
Member Author

Thank you for your review and your tweaks @tofumatt!

@jorgefilipecosta jorgefilipecosta added this to the 4.6 milestone Nov 28, 2018
@youknowriad youknowriad modified the milestones: 4.6, 4.7 Nov 29, 2018
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.

3 participants