From 5680a44403b480b4afbf54a447adb7e75cc6f3b4 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 2 Sep 2022 23:57:37 +0900 Subject: [PATCH 1/5] Button: fix iconSize prop doesn't work with some icons --- packages/components/src/icon/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/icon/index.tsx b/packages/components/src/icon/index.tsx index 94fe1d66c90a34..504a30444e16ed 100644 --- a/packages/components/src/icon/index.tsx +++ b/packages/components/src/icon/index.tsx @@ -82,9 +82,9 @@ function Icon< P >( { if ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) { const appliedProps = { + ...icon.props, width: size, height: size, - ...icon.props, ...additionalProps, }; From e47eea1daa9b833ef52462a1195dab9a8fa2bc0e Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sat, 3 Sep 2022 00:13:37 +0900 Subject: [PATCH 2/5] Update changelog --- packages/components/CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 47159ec62d079d..ade8e760124ec2 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -4,12 +4,13 @@ ### Bug Fix +- `Button`: Fix `iconSize` prop doesn't work with some icons ([#43821](https://github.com/WordPress/gutenberg/pull/43821)). - `Popover`: enable auto-updating every animation frame ([#43617](https://github.com/WordPress/gutenberg/pull/43617)). - `Popover`: improve the component's performance and reactivity to prop changes by reworking its internals ([#43335](https://github.com/WordPress/gutenberg/pull/43335)). ### Enhancements -- `ToggleControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43717](https://github.com/WordPress/gutenberg/pull/43717)). +- `ToggleControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43717](https://github.com/WordPress/gutenberg/pull/43717)). - `CheckboxControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43720](https://github.com/WordPress/gutenberg/pull/43720)). - `TextControl`, `TextareaControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43782](https://github.com/WordPress/gutenberg/pull/43782)). - `RangeControl`: Tweak dark gray marking color to be consistent with the grays in `@wordpress/base-styles` ([#43773](https://github.com/WordPress/gutenberg/pull/43773)). @@ -23,7 +24,7 @@ - `ToggleGroupControl`: Rename `__experimentalIsIconGroup` prop to `__experimentalIsBorderless` ([#43771](https://github.com/WordPress/gutenberg/pull/43771/)). - Refactor `FocalPointPicker` to function component ([#39168](https://github.com/WordPress/gutenberg/pull/39168)). - `Guide`: use `code` instead of `keyCode` for keyboard events ([#43604](https://github.com/WordPress/gutenberg/pull/43604/)). -- `ToggleControl`: Convert to TypeScript and streamline CSS ([#43717](https://github.com/WordPress/gutenberg/pull/43717)). +- `ToggleControl`: Convert to TypeScript and streamline CSS ([#43717](https://github.com/WordPress/gutenberg/pull/43717)). - `Navigation`: use `code` instead of `keyCode` for keyboard events ([#43644](https://github.com/WordPress/gutenberg/pull/43644/)). - `ComboboxControl`: Add unit tests ([#42403](https://github.com/WordPress/gutenberg/pull/42403)). - `NavigableContainer`: use `code` instead of `keyCode` for keyboard events, rewrite tests using RTL and `user-event` ([#43606](https://github.com/WordPress/gutenberg/pull/43606/)). From 59ebe2a25c8aafcd3f9550858c5d919ee06b4120 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sat, 3 Sep 2022 00:59:41 +0900 Subject: [PATCH 3/5] Update snapshot --- .../editor/plugins/__snapshots__/plugins-api.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap b/packages/e2e-tests/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap index 84e01859c32ff6..e2d70612669aef 100644 --- a/packages/e2e-tests/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +++ b/packages/e2e-tests/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap @@ -2,6 +2,6 @@ exports[`Using Plugins API Document Setting Custom Panel Should render a custom panel inside Document Setting sidebar 1`] = `"My Custom Panel"`; -exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"
(no title)
Plugin sidebar title
"`; +exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"
(no title)
Plugin sidebar title
"`; -exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"
(no title)
Plugin sidebar title
"`; +exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"
(no title)
Plugin sidebar title
"`; From 1b1866df2aa2aeca0b671682865b6e3a9b685abd Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sat, 3 Sep 2022 01:18:37 +0900 Subject: [PATCH 4/5] Update unit tests --- packages/components/src/icon/test/index.js | 6 +++--- .../test/__snapshots__/index.js.snap | 2 +- .../test/__snapshots__/index.js.snap | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/components/src/icon/test/index.js b/packages/components/src/icon/test/index.js index b1f85a3daf1654..d1c5b7123c3d87 100644 --- a/packages/components/src/icon/test/index.js +++ b/packages/components/src/icon/test/index.js @@ -63,7 +63,7 @@ describe( 'Icon', () => { expect( wrapper.prop( 'height' ) ).toBe( 24 ); } ); - it( 'renders an svg element and passes the size as its width and height', () => { + it( 'renders an svg element and override its width and height', () => { const wrapper = shallow( { /> ); - expect( wrapper.prop( 'width' ) ).toBe( 64 ); - expect( wrapper.prop( 'height' ) ).toBe( 64 ); + expect( wrapper.prop( 'width' ) ).toBe( 32 ); + expect( wrapper.prop( 'height' ) ).toBe( 32 ); } ); it( 'renders an svg element and does not override width and height if already specified', () => { diff --git a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap index f3603e5d5c9dd5..c74f2d35c38212 100644 --- a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; +exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; diff --git a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap index c47edef76f5165..7540e756111349 100644 --- a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap @@ -1,4 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; -q +exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; From 6c4d6a37df0a0789587e06281b3914671f5c19f0 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Mon, 5 Sep 2022 23:21:42 +0900 Subject: [PATCH 5/5] Update changelog --- packages/components/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index ade8e760124ec2..20558ced1c83a2 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -4,7 +4,7 @@ ### Bug Fix -- `Button`: Fix `iconSize` prop doesn't work with some icons ([#43821](https://github.com/WordPress/gutenberg/pull/43821)). +- `Button`, `Icon`: Fix `iconSize` prop doesn't work with some icons ([#43821](https://github.com/WordPress/gutenberg/pull/43821)). - `Popover`: enable auto-updating every animation frame ([#43617](https://github.com/WordPress/gutenberg/pull/43617)). - `Popover`: improve the component's performance and reactivity to prop changes by reworking its internals ([#43335](https://github.com/WordPress/gutenberg/pull/43335)).