Skip to content

Commit

Permalink
Remove useless onModeChange callback
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored and jorgefilipecosta committed Jan 3, 2020
1 parent 663f51f commit ca03d97
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
14 changes: 0 additions & 14 deletions packages/block-editor/src/components/link-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ An array of settings objects. Each object will used to render a `ToggleControl`

## Event handlers

### onChangeMode

- Type: `Function`
- Required: No

Use this callback to know when the LinkControl component changes its mode to `edit` or `show`
through of its function parameter.

```es6
<LinkControl
onChangeMode={ ( mode ) => { console.log( `Mode change to ${ mode } mode.` ) }
/>
```
### onClose

- Type: `Function`
Expand Down
6 changes: 0 additions & 6 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function LinkControl( {
fetchSearchSuggestions,
instanceId,
onClose = noop,
onChangeMode = noop,
onChange = noop,
} ) {
// State
Expand All @@ -71,7 +70,6 @@ function LinkControl( {
/**
* Handler function which switches the mode of the component,
* between `edit` and `show` mode.
* Also, it calls `onChangeMode` callback function.
*
* @param {string} mode Component mode: `show` or `edit`.
*/
Expand All @@ -83,10 +81,6 @@ function LinkControl( {
if ( value && value.title && mode === 'edit' ) {
setInputValue( value.title );
}

if ( isFunction( onChangeMode ) ) {
onChangeMode( mode );
}
};

const closeLinkUI = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ describe( 'Selecting links', () => {

it( 'should hide "selected" link UI and display search UI prepopulated with previously selected link title when "Change" button is clicked', () => {
const selectedLink = first( fauxEntitySuggestions );
const spyOnEditMode = jest.fn();

const LinkControlConsumer = () => {
const [ link, setLink ] = useState( selectedLink );
Expand All @@ -353,7 +352,6 @@ describe( 'Selecting links', () => {
value={ link }
onChange={ ( suggestion ) => setLink( suggestion ) }
fetchSearchSuggestions={ fetchFauxEntitySuggestions }
onChangeMode={ spyOnEditMode( 'edit' ) }
/>
);
};
Expand All @@ -380,7 +378,6 @@ describe( 'Selecting links', () => {
expect( searchInput ).not.toBeNull();
expect( searchInput.value ).toBe( selectedLink.title ); // prepopulated with previous link's title
expect( currentLinkUI ).toBeNull();
expect( spyOnEditMode ).toHaveBeenCalled();
} );

describe( 'Selection using mouse click', () => {
Expand Down

0 comments on commit ca03d97

Please sign in to comment.