Skip to content

Commit

Permalink
Merge pull request #5969 from WordPress/fix/rename-frequent-to-suggested
Browse files Browse the repository at this point in the history
Inserter: Rename Frequent → Suggested
  • Loading branch information
noisysocks authored Apr 5, 2018
2 parents 578b66a + bc194c9 commit 085afb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions editor/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class InserterMenu extends Component {
this.nodes = {};
this.state = {
filterValue: '',
tab: 'frequent',
tab: 'suggested',
selectedItem: null,
};
this.filter = this.filter.bind( this );
Expand All @@ -69,7 +69,7 @@ export class InserterMenu extends Component {
this.sortItems = this.sortItems.bind( this );
this.selectItem = this.selectItem.bind( this );

this.tabScrollTop = { frequent: 0, blocks: 0, embeds: 0 };
this.tabScrollTop = { suggested: 0, blocks: 0, embeds: 0 };
this.switchTab = this.switchTab.bind( this );
this.previewItem = this.previewItem.bind( this );
}
Expand Down Expand Up @@ -127,7 +127,7 @@ export class InserterMenu extends Component {

let predicate;
switch ( tab ) {
case 'frequent':
case 'suggested':
return frecentItems;

case 'blocks':
Expand All @@ -147,7 +147,7 @@ export class InserterMenu extends Component {
}

sortItems( items ) {
if ( 'frequent' === this.state.tab && ! this.state.filterValue ) {
if ( 'suggested' === this.state.tab && ! this.state.filterValue ) {
return items;
}

Expand Down Expand Up @@ -220,8 +220,8 @@ export class InserterMenu extends Component {
renderTabView( tab ) {
const itemsForTab = this.getItemsForTab( tab );

// If the Frequent tab is selected, don't render category headers
if ( 'frequent' === tab ) {
// If the Suggested tab is selected, don't render category headers
if ( 'suggested' === tab ) {
return this.renderItems( itemsForTab );
}

Expand All @@ -248,7 +248,7 @@ export class InserterMenu extends Component {

// Passed to TabbableContainer, extending its event-handling logic
eventToOffset( event ) {
// If a tab (Frequent, Blocks, …) is focused, pressing the down arrow
// If a tab (Suggested, Blocks, …) is focused, pressing the down arrow
// moves focus to the selected panel below.
if (
event.keyCode === keycodes.DOWN &&
Expand Down Expand Up @@ -297,8 +297,8 @@ export class InserterMenu extends Component {
onSelect={ this.switchTab }
tabs={ [
{
name: 'frequent',
title: __( 'Frequent' ),
name: 'suggested',
title: __( 'Suggested' ),
className: 'editor-inserter__tab',
},
{
Expand Down
6 changes: 3 additions & 3 deletions editor/components/inserter/test/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe( 'InserterMenu', () => {
// wrapper.find have had to be strengthened (and the filterWhere strengthened also), otherwise two
// results would be returned even though only one was in the DOM.

it( 'should show the frequent tab by default', () => {
it( 'should show the suggested tab by default', () => {
const wrapper = mount(
<InserterMenu
position={ 'top center' }
Expand All @@ -102,7 +102,7 @@ describe( 'InserterMenu', () => {
);

const activeCategory = wrapper.find( '.editor-inserter__tab button.is-active' );
expect( activeCategory.text() ).toBe( 'Frequent' );
expect( activeCategory.text() ).toBe( 'Suggested' );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks ).toHaveLength( 0 );
Expand All @@ -124,7 +124,7 @@ describe( 'InserterMenu', () => {
expect( visibleBlocks ).toHaveLength( 0 );
} );

it( 'should show the frequently used items in the frequent tab', () => {
it( 'should show frecently used items in the suggested tab', () => {
const wrapper = mount(
<InserterMenu
position={ 'top center' }
Expand Down

0 comments on commit 085afb0

Please sign in to comment.