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

Added a "plain" style for quote blocks #29856

Merged
merged 3 commits into from Oct 16, 2021

Conversation

Baelx
Copy link
Contributor

@Baelx Baelx commented Mar 14, 2021

Description

How has this been tested?

Ran npm run test. All tests passing.

Screenshots

image
image
image

Types of changes

Simply adds a "Plain" style to quotes to allow them(in part) to function as text indentation. Selecting "Plain" will set border-left: none in the code.

Checklist:

  • [ X ] My code is tested.
  • [ X ] My code follows the WordPress code style.
  • [ X ] My code follows the accessibility standards.
  • [ X ] I've tested my changes with keyboard and screen readers.
  • [ N/A ] My code has proper inline documentation.
  • [ N/A ] I've included developer documentation if appropriate.
  • [ N/A ] I've updated all React Native files affected by any refactorings/renamings in this PR.

@Baelx Baelx requested a review from ajitbohra as a code owner March 14, 2021 20:01
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 14, 2021
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Baelx! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@Baelx
Copy link
Contributor Author

Baelx commented Mar 15, 2021

I feel like npm run test should have caught the error here given it runs npm run test-e2e. Nevertheless, I'm now having a lot of difficulty generating a new snapshot for the quote block but that's all that's needed at this point. If someone with a fully-functional test framework for Gutenberg feels like pulling this branch, updating the snapshot, that'd be appreciated. Otherwise, I'll delete this PR until I'm up and running. Cheers.

Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

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

@Baelx Thanks for working on this, looks good in my testing.

I think this test is going to be troublesome because of the way it uses an index to click on a style:

If other styles are added it'll fail again. It'd be better to use the style's name. I updated the file to the following and it passes (the test description was also wrong so including it in my code snippet below):

describe( 'Block styles', () => {
	beforeAll( async () => {
		await createNewPost();
	} );

	it( 'Should switch to the large style of the quote block', async () => {
		// Inserting a quote block
		await insertBlock( 'Quote' );
		await page.keyboard.type( 'Quote content' );

		await clickBlockToolbarButton( 'Quote' );

		const largeStyleButton = await page.waitForXPath(
			'//*[@role="menuitem"][contains(., "Large")]'
		);
		await largeStyleButton.click();

		// Check the content
		const content = await getEditedPostContent();
		expect( content ).toMatchSnapshot();
	} );
} );

FWIW-I usually update snapshots using watch mode (npm run test-e2e:watch), sometimes I use the filters provided by watch mode to only run the test in the file in question.

@talldan talldan added [Block] Quote Affects the Quote Block [Type] Enhancement A suggestion for improvement. labels Mar 15, 2021
@Baelx
Copy link
Contributor Author

Baelx commented Mar 15, 2021

@Baelx Thanks for working on this, looks good in my testing.

I think this test is going to be troublesome because of the way it uses an index to click on a style:

If other styles are added it'll fail again. It'd be better to use the style's name. I updated the file to the following and it passes (the test description was also wrong so including it in my code snippet below):

describe( 'Block styles', () => {
	beforeAll( async () => {
		await createNewPost();
	} );

	it( 'Should switch to the large style of the quote block', async () => {
		// Inserting a quote block
		await insertBlock( 'Quote' );
		await page.keyboard.type( 'Quote content' );

		await clickBlockToolbarButton( 'Quote' );

		const largeStyleButton = await page.waitForXPath(
			'//*[@role="menuitem"][contains(., "Large")]'
		);
		await largeStyleButton.click();

		// Check the content
		const content = await getEditedPostContent();
		expect( content ).toMatchSnapshot();
	} );
} );

FWIW-I usually update snapshots using watch mode (npm run test-e2e:watch), sometimes I use the filters provided by watch mode to only run the test in the file in question.

Thanks a lot for that, @talldan. That makes sense!

@talldan
Copy link
Contributor

talldan commented Mar 18, 2021

@Baelx Just checking in, will you be able to update that test?

@Mamaduka
Copy link
Member

Mamaduka commented Sep 7, 2021

Hi, @Baelx

I just wanted to check in if you have time to rebase and update the test?

Thanks

@Mamaduka Mamaduka added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Sep 21, 2021
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

It looks like this one just needed a push to get over the hump. I rebased and moved the updated style definition to block.json.

I also updated the test and snapshot per @talldan.

So I think this makes it good to go.

@mkaz mkaz merged commit e306701 into WordPress:trunk Oct 16, 2021
@github-actions
Copy link

Congratulations on your first merged pull request, @Baelx! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Quote Affects the Quote Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants