Skip to content

Commit

Permalink
Edit Post: Remove menu toggling on checkbox, radio buttons (#14456)
Browse files Browse the repository at this point in the history
* Edit Post: Remove menu toggling on checkbox, radio buttons

* Fix failing e2e test
  • Loading branch information
aduth authored and gziolo committed Mar 27, 2019
1 parent 6c7bb3d commit 520c7d1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
5 changes: 4 additions & 1 deletion packages/e2e-tests/specs/editor-modes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ describe( 'Editing modes (visual/HTML)', () => {
let blockInspectorTab = await page.$( '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]' );
expect( blockInspectorTab ).not.toBeNull();

// Switch to Code Editor
// Switch to Code Editor and hide More Menu
await switchEditorModeTo( 'Code' );
await page.click(
'.edit-post-more-menu [aria-label="Hide more tools & options"]'
);

// The Block inspector should not be active anymore
blockInspectorTab = await page.$( '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default compose( [
withDispatch( ( dispatch, ownProps ) => ( {
onToggle() {
dispatch( 'core/edit-post' ).toggleFeature( ownProps.feature );
ownProps.onToggle();
},
} ) ),
withSpokenMessages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ export default compose( [
mode: select( 'core/edit-post' ).getEditorMode(),
} ) ),
ifCondition( ( { isRichEditingEnabled } ) => isRichEditingEnabled ),
withDispatch( ( dispatch, ownProps ) => ( {
withDispatch( ( dispatch ) => ( {
onSwitch( mode ) {
dispatch( 'core/edit-post' ).switchEditorMode( mode );
ownProps.onSelect( mode );
},
} ) ),
] )( ModeSwitcher );
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 @@ -33,8 +33,8 @@ const MoreMenu = () => (
) }
renderContent={ ( { onClose } ) => (
<Fragment>
<WritingMenu onClose={ onClose } />
<ModeSwitcher onSelect={ onClose } />
<WritingMenu />
<ModeSwitcher />
<PluginMoreMenuGroup.Slot fillProps={ { onClose } } />
<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />
<MenuGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ifViewportMatches } from '@wordpress/viewport';
*/
import FeatureToggle from '../feature-toggle';

function WritingMenu( { onClose } ) {
function WritingMenu() {
return (
<MenuGroup
label={ _x( 'View', 'noun' ) }
Expand All @@ -19,23 +19,20 @@ function WritingMenu( { onClose } ) {
feature="fixedToolbar"
label={ __( 'Top Toolbar' ) }
info={ __( 'Access all block and document tools in a single place' ) }
onToggle={ onClose }
messageActivated={ __( 'Top toolbar activated' ) }
messageDeactivated={ __( 'Top toolbar deactivated' ) }
/>
<FeatureToggle
feature="focusMode"
label={ __( 'Spotlight Mode' ) }
info={ __( 'Focus on one block at a time' ) }
onToggle={ onClose }
messageActivated={ __( 'Spotlight mode activated' ) }
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
/>
<FeatureToggle
feature="fullscreenMode"
label={ __( 'Fullscreen Mode' ) }
info={ __( 'Work without distraction' ) }
onToggle={ onClose }
messageActivated={ __( 'Fullscreen mode activated' ) }
messageDeactivated={ __( 'Fullscreen mode deactivated' ) }
/>
Expand Down

0 comments on commit 520c7d1

Please sign in to comment.