Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ const warning = (
</Warning>
);

export default () => warning;
export default function BlockCrashWarning() {
return warning;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ const warning = (
/>
);

export default () => warning;
export default function BlockCrashWarning() {
return warning;
}
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,4 @@ PublicForwardedRichTextContainer.isEmpty = ( value ) => {
export default PublicForwardedRichTextContainer;
export { RichTextShortcut } from './shortcut';
export { RichTextToolbarButton } from './toolbar-button';
export { __unstableRichTextInputEvent } from './input-event';
export { RichTextInputEvent as __unstableRichTextInputEvent } from './input-event';
Original file line number Diff line number Diff line change
Expand Up @@ -698,4 +698,4 @@ PrivateRichText.Raw = forwardRef( ( props, ref ) => (
export default PrivateRichText;
export { RichTextShortcut } from './shortcut';
export { RichTextToolbarButton } from './toolbar-button';
export { __unstableRichTextInputEvent } from './input-event';
export { RichTextInputEvent as __unstableRichTextInputEvent } from './input-event';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useEffect, useContext, useRef } from '@wordpress/element';
*/
import { inputEventContext } from './';

export function __unstableRichTextInputEvent( { inputType, onInput } ) {
export function RichTextInputEvent( { inputType, onInput } ) {
const callbacks = useContext( inputEventContext );
const onInputRef = useRef();
onInputRef.current = onInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { Component } from '@wordpress/element';

export class __unstableRichTextInputEvent extends Component {
export class RichTextInputEvent extends Component {
render() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
showUserSuggestions,
showXpostSuggestions,
} from '@wordpress/react-native-bridge';
import { BlockFormatControls } from '@wordpress/block-editor';
import { getPxFromCssUnit } from '@wordpress/components';
import { Component } from '@wordpress/element';
import {
Expand All @@ -42,6 +41,7 @@ import {
isCollapsed,
remove,
} from '@wordpress/rich-text';
import { BlockFormatControls } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -1342,22 +1342,23 @@ RichText.defaultProps = {
tagName: 'div',
};

const withFormatTypes = ( WrappedComponent ) => ( props ) => {
const {
clientId,
identifier,
withoutInteractiveFormatting,
allowedFormats,
} = props;
const { formatTypes } = useFormatTypes( {
clientId,
identifier,
withoutInteractiveFormatting,
allowedFormats,
} );

return <WrappedComponent { ...props } formatTypes={ formatTypes } />;
};
const withFormatTypes = ( WrappedComponent ) =>
function WithFormatTypes( props ) {
const {
clientId,
identifier,
withoutInteractiveFormatting,
allowedFormats,
} = props;
const { formatTypes } = useFormatTypes( {
clientId,
identifier,
withoutInteractiveFormatting,
allowedFormats,
} );

return <WrappedComponent { ...props } formatTypes={ formatTypes } />;
};

export default compose( [
withSelect( ( select, { clientId } ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ import {
} from '@wordpress/compose';

export default createHigherOrderComponent(
( WrappedComponent ) => ( props ) => {
const [ handleFocusOutside, setHandleFocusOutside ] = useState();
const bindFocusOutsideHandler = useCallback(
( node ) =>
setHandleFocusOutside( () =>
node?.handleFocusOutside
? node.handleFocusOutside.bind( node )
: undefined
),
[]
);
( WrappedComponent ) =>
function WithFocusOutside( props ) {
const [ handleFocusOutside, setHandleFocusOutside ] = useState();
const bindFocusOutsideHandler = useCallback(
( node ) =>
setHandleFocusOutside( () =>
node?.handleFocusOutside
? node.handleFocusOutside.bind( node )
: undefined
),
[]
);

return (
<View { ...useFocusOutside( handleFocusOutside ) }>
<WrappedComponent
ref={ bindFocusOutsideHandler }
{ ...props }
/>
</View>
);
},
return (
<View { ...useFocusOutside( handleFocusOutside ) }>
<WrappedComponent
ref={ bindFocusOutsideHandler }
{ ...props }
/>
</View>
);
},
'withFocusOutside'
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
*/
import { View } from 'react-native';

export default ( props ) => <View>{ props.children }</View>;
export default function ToolbarButtonContainer( props ) {
return <View>{ props.children }</View>;
}
6 changes: 3 additions & 3 deletions packages/core-data/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import type { WithPermissions } from './use-entity-records';
export type { WithPermissions };
export {
default as useEntityRecord,
__experimentalUseEntityRecord,
useDeprecatedEntityRecord as __experimentalUseEntityRecord,
} from './use-entity-record';
export {
default as useEntityRecords,
__experimentalUseEntityRecords,
useDeprecatedEntityRecords as __experimentalUseEntityRecords,
} from './use-entity-records';
export {
default as useResourcePermissions,
__experimentalUseResourcePermissions,
useDeprecatedResourcePermissions as __experimentalUseResourcePermissions,
} from './use-resource-permissions';
export { default as useEntityBlockEditor } from './use-entity-block-editor';
export { default as useEntityId } from './use-entity-id';
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/hooks/use-entity-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default function useEntityRecord< RecordType >(
};
}

export function __experimentalUseEntityRecord(
export function useDeprecatedEntityRecord(
kind: string,
name: string,
recordId: any,
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/hooks/use-entity-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function useEntityRecords< RecordType >(
};
}

export function __experimentalUseEntityRecords(
export function useDeprecatedEntityRecords(
kind: string,
name: string,
queryArgs: any,
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/hooks/use-resource-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function useResourcePermissions< IdType = void >(

export default useResourcePermissions;

export function __experimentalUseResourcePermissions(
export function useDeprecatedResourcePermissions(
resource: string,
id?: unknown
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Compiler } from 'webpack';
import type { Compiler } from 'webpack';

export = DependencyExtractionWebpackPlugin;

Expand Down
2 changes: 2 additions & 0 deletions packages/e2e-test-utils-playwright/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Playwright fixtures use `use()` which is not a React hook.

/**
* External dependencies
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
privateApis as coreDataPrivateApis,
SelectionType,
type PostEditorAwarenessState as ActiveCollaborator,
} from '@wordpress/core-data';
import type {
ResolvedSelection,
PostEditorAwarenessState as ActiveCollaborator,
} from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { useEffect, useState } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';
import type { ResolvedSelection } from '@wordpress/core-data';

import { unlock } from '../../lock-unlock';
import { getAvatarUrl } from './get-avatar-url';
Expand Down
4 changes: 2 additions & 2 deletions packages/fields/src/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { DataForm, DataViews, type Form } from '@wordpress/dataviews';
import type { Field, View } from '@wordpress/dataviews';
import type { Field, View, Form } from '@wordpress/dataviews';
import { DataForm, DataViews } from '@wordpress/dataviews';

/**
* Internal dependencies
Expand Down
4 changes: 2 additions & 2 deletions packages/media-fields/src/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { DataForm, DataViews, type Form } from '@wordpress/dataviews';
import type { Field, View } from '@wordpress/dataviews';
import type { Field, View, Form } from '@wordpress/dataviews';
import { DataForm, DataViews } from '@wordpress/dataviews';

/**
* Internal dependencies
Expand Down
18 changes: 9 additions & 9 deletions packages/report-flaky-tests/src/__tests__/markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ describe( 'renderIssueBody', () => {
totalCommits: 100,
};

const body = renderIssueBody( {
const view = renderIssueBody( {
meta,
testTitle: 'Test title',
testPath: 'test/e2e/specs/test-title.spec.js',
formattedTestResults: 'FORMATTED_TEST_RESULTS',
} );

expect( body ).toMatchInlineSnapshot( `
expect( view ).toMatchInlineSnapshot( `
"<!-- __META_DATA__:{"failedTimes":5,"totalCommits":100} -->
**Flaky test detected. This is an auto-generated issue by GitHub Actions. Please do NOT edit this manually.**

Expand Down Expand Up @@ -195,16 +195,16 @@ describe( 'parseIssueBody', () => {
totalCommits: 95,
};

const body = renderIssueBody( {
const view = renderIssueBody( {
meta,
testTitle: 'Test title',
testPath: 'test/e2e/specs/test-title.spec.js',
formattedTestResults: testResults.join( '\n' ),
} );

expect( body ).toMatchSnapshot();
expect( view ).toMatchSnapshot();

const parsed = parseIssueBody( body );
const parsed = parseIssueBody( view );

expect( core.error ).toHaveBeenCalledTimes( 1 );

Expand Down Expand Up @@ -248,13 +248,13 @@ describe( 'renderCommitComment', () => {
];
const commitSHA = 'commitSHA';

const commentBody = renderCommitComment( {
const view = renderCommitComment( {
reportedIssues,
runURL,
commitSHA,
} );

expect( commentBody ).toMatchInlineSnapshot( `
expect( view ).toMatchInlineSnapshot( `
"<!-- flaky-tests-report-comment -->
**Flaky tests detected in commitSHA.**
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See [the documentation](https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/testing-overview.md#flaky-tests) for more information.
Expand All @@ -269,13 +269,13 @@ describe( 'renderCommitComment', () => {

describe( 'isReportComment', () => {
it( 'matches the report comment', () => {
const commentBody = renderCommitComment( {
const view = renderCommitComment( {
reportedIssues: [],
runURL: '',
commitSHA: 'commitSHA',
} );

expect( isReportComment( commentBody ) ).toBe( true );
expect( isReportComment( view ) ).toBe( true );

expect( isReportComment( 'random string' ) ).toBe( false );
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/rich-text/src/hook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export function useRichText( {
return { ...result, formatTypes };
}

export function __unstableUseRichText( props ) {
export function useDeprecatedRichText( props ) {
deprecated( '`__unstableUseRichText` hook', {
since: '7.0',
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/rich-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export { createElement as __unstableCreateElement } from './create-element';
export { privateApis } from './private-apis';
export { useAnchorRef } from './hook/use-anchor-ref';
export { useAnchor } from './hook/use-anchor';
export { __unstableUseRichText } from './hook';
export { useDeprecatedRichText as __unstableUseRichText } from './hook';

// Remnant that is left in an abundance of caution to ensure there's no errors.
export function __experimentalRichText() {}
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/specs/editor/blocks/avatar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ test.describe( 'Avatar', () => {
await newUser.click();

const updatedAvatarImage = avatarBlock.locator( 'img' );
const newSrc = await updatedAvatarImage.getAttribute( 'src' );

expect( newSrc ).not.toBe( originalSrc );
await expect( updatedAvatarImage ).not.toHaveAttribute(
'src',
originalSrc
);
} );
} );
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/copy-cut-paste.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ test.describe( 'Copy/cut/paste', () => {
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'should cut partial selection and merge like a normal `delete` - not forward ', async ( {
test( 'should cut partial selection and merge like a normal `delete` - not forward', async ( {
editor,
page,
pageUtils,
Expand Down Expand Up @@ -405,7 +405,7 @@ test.describe( 'Copy/cut/paste', () => {
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'should paste plain text in plain text context when cross block selection is copied ', async ( {
test( 'should paste plain text in plain text context when cross block selection is copied', async ( {
editor,
page,
pageUtils,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/post-title.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ test.describe( 'Post title', () => {
);
} );

test( `should show raw HTML in the post title field when in Code view mode `, async ( {
test( `should show raw HTML in the post title field when in Code view mode`, async ( {
page,
admin,
requestUtils,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/pref-modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.describe( 'Preferences modal', () => {
} );

test.describe( 'Preferences modal adaps to viewport', () => {
test( 'Enable pre-publish checks is visible on desktop ', async ( {
test( 'Enable pre-publish checks is visible on desktop', async ( {
page,
} ) => {
await page.click(
Expand All @@ -25,7 +25,7 @@ test.describe( 'Preferences modal', () => {
} );
} );
test.describe( 'Preferences modal adaps to viewport', () => {
test( 'Enable pre-publish checks is not visible on mobile ', async ( {
test( 'Enable pre-publish checks is not visible on mobile', async ( {
page,
} ) => {
await page.setViewportSize( { width: 500, height: 800 } );
Expand Down
Loading
Loading