Skip to content

Commit

Permalink
Rename 'Recent' tab to 'Frequent'
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Mar 5, 2018
1 parent 4632d01 commit f754b1a
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: 'recent',
tab: 'frequent',
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 = { recent: 0, blocks: 0, embeds: 0 };
this.tabScrollTop = { frequent: 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 'recent':
case 'frequent':
return frecentItems;

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

sortItems( items ) {
if ( 'recent' === this.state.tab && ! this.state.filterValue ) {
if ( 'frequent' === 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 Recent tab is selected, don't render category headers
if ( 'recent' === tab ) {
// If the Frequent tab is selected, don't render category headers
if ( 'frequent' === 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 (Recent, Blocks, …) is focused, pressing the down arrow
// If a tab (Frequent, Blocks, …) is focused, pressing the down arrow
// moves focus to the selected panel below.
if (
event.keyCode === keycodes.DOWN &&
Expand Down Expand Up @@ -291,8 +291,8 @@ export class InserterMenu extends Component {
onSelect={ this.switchTab }
tabs={ [
{
name: 'recent',
title: __( 'Recent' ),
name: 'frequent',
title: __( 'Frequent' ),
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 recent tab by default', () => {
it( 'should show the frequent 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( 'Recent' );
expect( activeCategory.text() ).toBe( 'Frequent' );

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 recently used items in the recent tab', () => {
it( 'should show the frequently used items in the frequent tab', () => {
const wrapper = mount(
<InserterMenu
position={ 'top center' }
Expand Down

0 comments on commit f754b1a

Please sign in to comment.