Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 27, 2020
1 parent 2ed83d5 commit fdb5b84
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`BlockControls should render a dynamic toolbar of controls 1`] = `
<WithFilters(Edit)
isSelected={true}
>
<BlockControls
<IfDisplayBlockControls(BlockControlsFill)
controls={
Array [
Object {
Expand Down Expand Up @@ -60,7 +60,7 @@ exports[`BlockControls should render a dynamic toolbar of controls 1`] = `
<p>
Child
</p>
</BlockControls>
</IfDisplayBlockControls(BlockControlsFill)>
</WithFilters(Edit)>
</ContextProvider>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
import { createHigherOrderComponent } from '@wordpress/compose';

/**
* Internal dependencies
*/
import { useBlockEditContext } from '../block-edit/context';

export default function ifDisplayBlockControls( Component ) {
return ( { children } ) => {
export default createHigherOrderComponent(
( Component ) => ( { children } ) => {
const { isSelected, clientId, name } = useBlockEditContext();
const isFirstAndSameTypeMultiSelected = useSelect(
( select ) => {
Expand All @@ -35,5 +36,6 @@ export default function ifDisplayBlockControls( Component ) {
}

return <Component>{ children }</Component>;
};
}
},
'ifDisplayBlockControls'
);
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/color-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function ColorPanel( {
} );

return (
<InspectorControls allowAnyMultiple>
<InspectorControls>
<PanelColorGradientSettings
title={ __( 'Color settings' ) }
initialOpen={ false }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const withBlockControls = createHigherOrderComponent(

return [
Platform.OS === 'web' && hasTypographySupport && (
<InspectorControls key="typography" allowAnyMultiple>
<InspectorControls key="typography">
<PanelBody title={ __( 'Typography' ) }>
<FontSizeEdit { ...props } />
<LineHeightEdit { ...props } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`core/more/edit should match snapshot when noTeaser is false 1`] = `
<React.Fragment>
<InspectorControls>
<IfDisplayBlockControls(InspectorControlsFill)>
<ForwardRef(PanelBody)>
<WithInstanceId(ToggleControl)
checked={false}
Expand All @@ -11,7 +11,7 @@ exports[`core/more/edit should match snapshot when noTeaser is false 1`] = `
onChange={[Function]}
/>
</ForwardRef(PanelBody)>
</InspectorControls>
</IfDisplayBlockControls(InspectorControlsFill)>
<div
className="wp-block-more"
>
Expand All @@ -32,7 +32,7 @@ exports[`core/more/edit should match snapshot when noTeaser is false 1`] = `

exports[`core/more/edit should match snapshot when noTeaser is true 1`] = `
<React.Fragment>
<InspectorControls>
<IfDisplayBlockControls(InspectorControlsFill)>
<ForwardRef(PanelBody)>
<WithInstanceId(ToggleControl)
checked={true}
Expand All @@ -41,7 +41,7 @@ exports[`core/more/edit should match snapshot when noTeaser is true 1`] = `
onChange={[Function]}
/>
</ForwardRef(PanelBody)>
</InspectorControls>
</IfDisplayBlockControls(InspectorControlsFill)>
<div
className="wp-block-more"
>
Expand Down

0 comments on commit fdb5b84

Please sign in to comment.