Skip to content

Commit

Permalink
no search results term
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Duthie <andrew@andrewduthie.com>
  • Loading branch information
youknowriad and aduth committed May 4, 2020
1 parent 7babfa3 commit 07a246a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
4 changes: 1 addition & 3 deletions packages/block-editor/src/components/inserter/block-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ function InserterBlockList( {
);
}
if ( ! hasItems ) {
return (
<InserterNoResults filterValue={ filterValue } />
);
return <InserterNoResults />;
}
return null;
} }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function BlockPatterns( { patterns, onInsert, filterValue } ) {
) }
</InserterPanel>
) : (
<InserterNoResults filterValue={ filterValue } />
<InserterNoResults />
);
}

Expand Down
16 changes: 3 additions & 13 deletions packages/block-editor/src/components/inserter/no-results.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
/**
* WordPress dependencies
*/
import { createInterpolateElement } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { Icon, blockDefault } from '@wordpress/icons';

function InserterNoResults( { filterValue } ) {
function InserterNoResults() {
return (
<div className="block-editor-inserter__no-results">
<Icon
className="block-editor-inserter__no-results-icon"
icon={ blockDefault }
/>
<p>
{ createInterpolateElement(
sprintf(
/* translators: %s: search term. */
__( 'Sorry no results found on <strong>%s</strong>.' ),
filterValue
),
{ strong: <strong /> }
) }
</p>
<p>{ __( 'No results found.' ) }</p>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ const assertNoResultsMessageToBePresent = ( element ) => {
const noResultsMessage = element.querySelector(
'.block-editor-inserter__no-results'
);
expect( noResultsMessage.textContent ).toEqual(
'Sorry no results found on random.'
);
expect( noResultsMessage.textContent ).toEqual( 'No results found.' );
};

const assertNoResultsMessageNotToBePresent = ( element ) => {
Expand Down

0 comments on commit 07a246a

Please sign in to comment.