Skip to content

Commit

Permalink
Remove Create option from initial suggestions
Browse files Browse the repository at this point in the history
Addresses #18900 (comment)

If we need to reinstate this functionality we can simply revert this commit.
  • Loading branch information
getdave committed Feb 14, 2020
1 parent 28ee868 commit c6cab25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function LinkControl( {

const directLinkEntryTypes = [ 'url', 'mailto', 'tel', 'internal' ];
const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes( suggestions[ 0 ].type.toLowerCase() );
const shouldShowCreateEntity = showCreateEntity && createEntity && ! isSingleDirectEntryResult;
const shouldShowCreateEntity = showCreateEntity && createEntity && ! isSingleDirectEntryResult && ! isInitialSuggestions;
: undefined;
const labelText = isInitialSuggestions
? __( 'Recently updated' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
expect( currentLinkHTML ).toEqual( expect.stringContaining( '/?p=123' ) ); // slug
} );

it( 'should show option to create "blank" entity in initial suggestions (when input is empty)', async () => {
it( 'should show not show an option to create "blank" entity in initial suggestions (when input is empty)', async () => {
act( () => {
render(
<LinkControl
Expand Down Expand Up @@ -618,8 +618,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {

// Verify input has no value
expect( searchInput.value ).toBe( '' );
expect( createButton ).not.toBeNull();
expect( createButton.innerHTML ).toEqual( expect.stringContaining( 'Create new' ) );
expect( createButton ).toBeNull(); // shouldn't exist!
} );

it.each( [
Expand Down

0 comments on commit c6cab25

Please sign in to comment.