diff --git a/packages/block-editor/src/components/link-control/README.md b/packages/block-editor/src/components/link-control/README.md index 39f1d09de18ed..158ef9d4c95ea 100644 --- a/packages/block-editor/src/components/link-control/README.md +++ b/packages/block-editor/src/components/link-control/README.md @@ -2,15 +2,10 @@ ## Props -### className - -- Type: `String` -- Required: Yes - ### value - Type: `Object` -- Required: Yes +- Required: No ### settings @@ -28,8 +23,6 @@ An array of settings objects. Each object will used to render a `ToggleControl` for that setting. -## Event handlers - ### onClose - Type: `Function` @@ -41,14 +34,12 @@ An array of settings objects. Each object will used to render a `ToggleControl` - Required: No Use this callback to take an action after a user set or updated a link. -The function callback will receive the selected item, or Null. +The function callback will receive the selected item. -```es6 +```jsx { - item - ? console.log( `The item selected has the ${ item.id } id.` ) - : console.warn( 'No Item selected.' ); + onChange={ ( item ) => { + console.log( `The item selected has the ${ item.id } id.` ); } /> ``` diff --git a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap index 0ec98237c9486..046a4d31fd861 100644 --- a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Basic rendering should display with required props 1`] = `""`; +exports[`Basic rendering should render 1`] = `""`; diff --git a/packages/block-editor/src/components/link-control/test/index.js b/packages/block-editor/src/components/link-control/test/index.js index 944018ba155e2..ff5ae8f622fb2 100644 --- a/packages/block-editor/src/components/link-control/test/index.js +++ b/packages/block-editor/src/components/link-control/test/index.js @@ -51,20 +51,15 @@ afterEach( () => { } ); describe( 'Basic rendering', () => { - it( 'should display with required props', () => { + it( 'should render', () => { act( () => { - render( - , container - ); + render( , container ); } ); // Search Input UI const searchInput = container.querySelector( 'input[aria-label="URL"]' ); - // expect( searchInputLabel ).not.toBeNull(); expect( searchInput ).not.toBeNull(); - expect( container.innerHTML ).toMatchSnapshot(); } ); } ); @@ -465,7 +460,7 @@ describe( 'Selecting links', () => { } ], // url ] )( 'should display a current selected link UI when a %s suggestion for the search "%s" is clicked', async ( type, searchTerm, selectedLink ) => { const LinkControlConsumer = () => { - const [ link, setLink ] = useState( null ); + const [ link, setLink ] = useState(); return ( { } ], // url ] )( 'should display a current selected link UI when an %s suggestion for the search "%s" is selected using the keyboard', async ( type, searchTerm, selectedLink ) => { const LinkControlConsumer = () => { - const [ link, setLink ] = useState( null ); + const [ link, setLink ] = useState(); return (