Skip to content

Commit

Permalink
Rename "Options" modal to "Preferences". (#25683)
Browse files Browse the repository at this point in the history
* Rename "Options" modal to "Preferences".

* Simplify "Keyboard options" to "Keyboard".
  • Loading branch information
ZebulanStanphill committed Oct 9, 2020
1 parent c1390e0 commit 78585d6
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/toggle-screen-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { clickOnMoreMenuItem } from './click-on-more-menu-item';
* undefined, the option will be toggled.
*/
export async function toggleScreenOption( label, shouldBeChecked = undefined ) {
await clickOnMoreMenuItem( 'Options' );
await clickOnMoreMenuItem( 'Preferences' );
const [ handle ] = await page.$x(
`//label[contains(text(), "${ label }")]`
);
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e-tests/specs/editor/various/preview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ async function waitForPreviewNavigation( previewPage ) {
*/
async function toggleCustomFieldsOption( shouldBeChecked ) {
const checkboxXPath =
'//*[contains(@class, "edit-post-options-modal")]//label[contains(text(), "Custom fields")]';
await clickOnMoreMenuItem( 'Options' );
'//*[contains(@class, "edit-post-preferences-modal")]//label[contains(text(), "Custom fields")]';
await clickOnMoreMenuItem( 'Preferences' );
await page.waitForXPath( checkboxXPath );
const [ checkboxHandle ] = await page.$x( checkboxXPath );

Expand All @@ -102,7 +102,7 @@ async function toggleCustomFieldsOption( shouldBeChecked ) {
return;
}

await clickOnCloseModalButton( '.edit-post-options-modal' );
await clickOnCloseModalButton( '.edit-post-preferences-modal' );
}

describe( 'Preview', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-post/src/components/header/more-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { useViewportMatch } from '@wordpress/compose';
* Internal dependencies
*/
import ModeSwitcher from '../mode-switcher';
import PreferencesMenuItem from '../preferences-menu-item';
import ToolsMoreMenuGroup from '../tools-more-menu-group';
import OptionsMenuItem from '../options-menu-item';
import WritingMenu from '../writing-menu';

const POPOVER_PROPS = {
Expand Down Expand Up @@ -57,7 +57,7 @@ const MoreMenu = ( { showIconLabels } ) => {
/>
<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />
<MenuGroup>
<OptionsMenuItem />
<PreferencesMenuItem />
</MenuGroup>
</>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { withDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { MenuItem } from '@wordpress/components';

export function OptionsMenuItem( { openModal } ) {
export function PreferencesMenuItem( { openModal } ) {
return (
<MenuItem
onClick={ () => {
openModal( 'edit-post/options' );
openModal( 'edit-post/preferences' );
} }
>
{ __( 'Options' ) }
{ __( 'Preferences' ) }
</MenuItem>
);
}
Expand All @@ -23,4 +23,4 @@ export default withDispatch( ( dispatch ) => {
return {
openModal,
};
} )( OptionsMenuItem );
} )( PreferencesMenuItem );
4 changes: 2 additions & 2 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import VisualEditor from '../visual-editor';
import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
import ManageBlocksModal from '../manage-blocks-modal';
import OptionsModal from '../options-modal';
import PreferencesModal from '../preferences-modal';
import BrowserURL from '../browser-url';
import Header from '../header';
import SettingsSidebar from '../sidebar/settings-sidebar';
Expand Down Expand Up @@ -290,7 +290,7 @@ function Layout() {
} }
/>
<ManageBlocksModal />
<OptionsModal />
<PreferencesModal />
<KeyboardShortcutHelpModal />
<WelcomeGuide />
<Popover.Slot />
Expand Down
8 changes: 0 additions & 8 deletions packages/edit-post/src/components/options-modal/section.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ import {
} from './options';
import MetaBoxesSection from './meta-boxes-section';

const MODAL_NAME = 'edit-post/options';
const MODAL_NAME = 'edit-post/preferences';

export function OptionsModal( { isModalActive, isViewable, closeModal } ) {
export function PreferencesModal( { isModalActive, isViewable, closeModal } ) {
if ( ! isModalActive ) {
return null;
}

return (
<Modal
className="edit-post-options-modal"
title={ __( 'Options' ) }
className="edit-post-preferences-modal"
title={ __( 'Preferences' ) }
closeLabel={ __( 'Close' ) }
onRequestClose={ closeModal }
>
Expand All @@ -59,7 +59,7 @@ export function OptionsModal( { isModalActive, isViewable, closeModal } ) {
label={ __( 'Show button text labels' ) }
/>
</Section>
<Section title={ __( 'Keyboard options' ) }>
<Section title={ __( 'Keyboard' ) }>
<EnableFeature
featureName="keepCaretInsideBlock"
label={ __( 'Contain text cursor inside active block' ) }
Expand Down Expand Up @@ -145,4 +145,4 @@ export default compose(
closeModal: () => dispatch( 'core/edit-post' ).closeModal(),
};
} )
)( OptionsModal );
)( PreferencesModal );
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CheckboxControl } from '@wordpress/components';

function BaseOption( { label, isChecked, onChange, children } ) {
return (
<div className="edit-post-options-modal__option">
<div className="edit-post-preferences-modal__option">
<CheckboxControl
label={ label }
checked={ isChecked }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export function CustomFieldsConfirmation( { willEnable } ) {

return (
<>
<p className="edit-post-options-modal__custom-fields-confirmation-message">
<p className="edit-post-preferences-modal__custom-fields-confirmation-message">
{ __(
'A page reload is required for this change. Make sure your content is saved before reloading.'
) }
</p>
<Button
className="edit-post-options-modal__custom-fields-confirmation-button"
className="edit-post-preferences-modal__custom-fields-confirmation-button"
isSecondary
isBusy={ isReloading }
disabled={ isReloading }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation message when toggled on 1`] = `
<div
className="edit-post-options-modal__option"
className="edit-post-preferences-modal__option"
>
<div
className="components-base-control"
Expand Down Expand Up @@ -43,12 +43,12 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
</div>
</div>
<p
className="edit-post-options-modal__custom-fields-confirmation-message"
className="edit-post-preferences-modal__custom-fields-confirmation-message"
>
A page reload is required for this change. Make sure your content is saved before reloading.
</p>
<button
className="components-button edit-post-options-modal__custom-fields-confirmation-button is-secondary"
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
disabled={false}
onClick={[Function]}
type="button"
Expand All @@ -60,7 +60,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation

exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields are enabled 1`] = `
<div
className="edit-post-options-modal__option"
className="edit-post-preferences-modal__option"
>
<div
className="components-base-control"
Expand Down Expand Up @@ -105,7 +105,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields

exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmation message when toggled off 1`] = `
<div
className="edit-post-options-modal__option"
className="edit-post-preferences-modal__option"
>
<div
className="components-base-control"
Expand All @@ -132,12 +132,12 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
</div>
</div>
<p
className="edit-post-options-modal__custom-fields-confirmation-message"
className="edit-post-preferences-modal__custom-fields-confirmation-message"
>
A page reload is required for this change. Make sure your content is saved before reloading.
</p>
<button
className="components-button edit-post-options-modal__custom-fields-confirmation-button is-secondary"
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
disabled={false}
onClick={[Function]}
type="button"
Expand All @@ -149,7 +149,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati

exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fields are disabled 1`] = `
<div
className="edit-post-options-modal__option"
className="edit-post-preferences-modal__option"
>
<div
className="components-base-control"
Expand Down
10 changes: 10 additions & 0 deletions packages/edit-post/src/components/preferences-modal/section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const Section = ( { title, children } ) => (
<section className="edit-post-preferences-modal__section">
<h2 className="edit-post-preferences-modal__section-title">
{ title }
</h2>
{ children }
</section>
);

export default Section;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.edit-post-options-modal {
.edit-post-preferences-modal {
&__section {
margin: 0 0 2rem 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`OptionsModal should match snapshot when the modal is active 1`] = `
exports[`PreferencesModal should match snapshot when the modal is active 1`] = `
<WithInstanceId(Modal)
className="edit-post-options-modal"
className="edit-post-preferences-modal"
closeLabel="Close"
title="Options"
title="Preferences"
>
<Section
title="General"
Expand All @@ -22,7 +22,7 @@ exports[`OptionsModal should match snapshot when the modal is active 1`] = `
/>
</Section>
<Section
title="Keyboard options"
title="Keyboard"
>
<WithSelect(WithDispatch(BaseOption))
featureName="keepCaretInsideBlock"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { shallow } from 'enzyme';
/**
* Internal dependencies
*/
import { OptionsModal } from '../';
import { PreferencesModal } from '../';

describe( 'OptionsModal', () => {
describe( 'PreferencesModal', () => {
it( 'should match snapshot when the modal is active', () => {
const wrapper = shallow( <OptionsModal isModalActive={ true } /> );
const wrapper = shallow( <PreferencesModal isModalActive={ true } /> );
expect( wrapper ).toMatchSnapshot();
} );

it( 'should not render when the modal is not active', () => {
const wrapper = shallow( <OptionsModal isModalActive={ false } /> );
const wrapper = shallow( <PreferencesModal isModalActive={ false } /> );
expect( wrapper.isEmptyRender() ).toBe( true );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import warning from '@wordpress/warning';
/**
* Internal dependencies
*/
import { EnablePluginDocumentSettingPanelOption } from '../../options-modal/options';
import { EnablePluginDocumentSettingPanelOption } from '../../preferences-modal/options';

export const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );

Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@import "./components/layout/style.scss";
@import "./components/manage-blocks-modal/style.scss";
@import "./components/meta-boxes/meta-boxes-area/style.scss";
@import "./components/preferences-modal/style.scss";
@import "./components/sidebar/style.scss";
@import "./components/sidebar/last-revision/style.scss";
@import "./components/sidebar/post-author/style.scss";
Expand All @@ -18,7 +19,6 @@
@import "./components/sidebar/settings-header/style.scss";
@import "./components/text-editor/style.scss";
@import "./components/visual-editor/style.scss";
@import "./components/options-modal/style.scss";
@import "./components/welcome-guide/style.scss";

/**
Expand Down

0 comments on commit 78585d6

Please sign in to comment.