From a7ad8b2970f4b8f6962fe5d81f94e6ca0e3b5d08 Mon Sep 17 00:00:00 2001 From: PARTHVATALIYA Date: Tue, 12 Nov 2024 14:27:18 +0530 Subject: [PATCH 1/3] Add the console warning for 36px size variation --- packages/components/src/font-size-picker/README.md | 1 + packages/components/src/font-size-picker/index.tsx | 7 +++++++ .../src/font-size-picker/stories/index.story.tsx | 1 + packages/components/src/font-size-picker/test/index.tsx | 6 +++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/components/src/font-size-picker/README.md b/packages/components/src/font-size-picker/README.md index 5d7fe2b39a7373..39d916c0c7b212 100644 --- a/packages/components/src/font-size-picker/README.md +++ b/packages/components/src/font-size-picker/README.md @@ -29,6 +29,7 @@ const MyFontSizePicker = () => { return ( { __( 'Font size' ) } diff --git a/packages/components/src/font-size-picker/stories/index.story.tsx b/packages/components/src/font-size-picker/stories/index.story.tsx index eec8f5173d9655..a0d83756ca1ec9 100644 --- a/packages/components/src/font-size-picker/stories/index.story.tsx +++ b/packages/components/src/font-size-picker/stories/index.story.tsx @@ -66,6 +66,7 @@ const TwoFontSizePickersWithState: StoryFn< typeof FontSizePicker > = ( { export const Default: StoryFn< typeof FontSizePicker > = FontSizePickerWithState.bind( {} ); Default.args = { + __next40pxDefaultSize: true, disableCustomFontSizes: false, fontSizes: [ { diff --git a/packages/components/src/font-size-picker/test/index.tsx b/packages/components/src/font-size-picker/test/index.tsx index e7205e57eefaa6..7a49af2500c1cc 100644 --- a/packages/components/src/font-size-picker/test/index.tsx +++ b/packages/components/src/font-size-picker/test/index.tsx @@ -46,7 +46,11 @@ describe( 'FontSizePicker', () => { const user = userEvent.setup(); const onChange = jest.fn(); await render( - + ); const input = screen.getByLabelText( 'Custom' ); await user.clear( input ); From 76da9931585c8298a420725628ce6baca505b5ba Mon Sep 17 00:00:00 2001 From: PARTHVATALIYA Date: Tue, 12 Nov 2024 14:31:36 +0530 Subject: [PATCH 2/3] Add the changelog for the deprecation --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 93b191bff269d6..472e9bf9732bc9 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -24,6 +24,7 @@ - `BorderBoxControl`: Deprecate 36px default size ([#65752](https://github.com/WordPress/gutenberg/pull/65752)). - `BorderControl`: Deprecate 36px default size ([#65755](https://github.com/WordPress/gutenberg/pull/65755)). +- `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)). ### Bug Fixes From b0a9775798224d9a0ab1490531dab0f2d471e104 Mon Sep 17 00:00:00 2001 From: parthVataliya16 Date: Tue, 19 Nov 2024 10:51:36 +0530 Subject: [PATCH 3/3] Update: changelog and test for all tests need to pass --- packages/components/CHANGELOG.md | 2 +- packages/components/src/font-size-picker/index.tsx | 2 +- .../components/src/font-size-picker/test/index.tsx | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 472e9bf9732bc9..b067a462a3716b 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -5,6 +5,7 @@ ### Deprecations - `Radio`: Deprecate 36px default size ([#66572](https://github.com/WordPress/gutenberg/pull/66572)). +- `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)). ### Enhancements @@ -24,7 +25,6 @@ - `BorderBoxControl`: Deprecate 36px default size ([#65752](https://github.com/WordPress/gutenberg/pull/65752)). - `BorderControl`: Deprecate 36px default size ([#65755](https://github.com/WordPress/gutenberg/pull/65755)). -- `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)). ### Bug Fixes diff --git a/packages/components/src/font-size-picker/index.tsx b/packages/components/src/font-size-picker/index.tsx index 9b180aaddd27d4..d4e8ea29fc6c4f 100644 --- a/packages/components/src/font-size-picker/index.tsx +++ b/packages/components/src/font-size-picker/index.tsx @@ -127,7 +127,7 @@ const UnforwardedFontSizePicker = ( maybeWarnDeprecated36pxSize( { componentName: 'FontSizePicker', __next40pxDefaultSize, - size: undefined, + size, } ); return ( diff --git a/packages/components/src/font-size-picker/test/index.tsx b/packages/components/src/font-size-picker/test/index.tsx index 7a49af2500c1cc..34e8ce17c67fa6 100644 --- a/packages/components/src/font-size-picker/test/index.tsx +++ b/packages/components/src/font-size-picker/test/index.tsx @@ -8,13 +8,17 @@ import { render } from '@ariakit/test/react'; /** * Internal dependencies */ -import FontSizePicker from '../'; +import _FontSizePicker from '../'; import type { FontSize } from '../types'; /** * WordPress dependencies */ import { useState } from '@wordpress/element'; +const FontSizePicker = ( + props: React.ComponentProps< typeof _FontSizePicker > +) => <_FontSizePicker __next40pxDefaultSize { ...props } />; + const ControlledFontSizePicker = ( { onChange, ...props @@ -46,11 +50,7 @@ describe( 'FontSizePicker', () => { const user = userEvent.setup(); const onChange = jest.fn(); await render( - + ); const input = screen.getByLabelText( 'Custom' ); await user.clear( input );