Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserter: Rename Frequent → Suggested #5969

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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