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

Adding messaging for open and closed states #10900

Merged
merged 13 commits into from
Oct 29, 2018
7 changes: 5 additions & 2 deletions packages/edit-post/src/components/header/more-menu/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { IconButton, Dropdown, MenuGroup } from '@wordpress/components';
import { Fragment } from '@wordpress/element';

Expand All @@ -14,6 +14,9 @@ import ToolsMoreMenuGroup from '../tools-more-menu-group';
import OptionsMenuItem from '../options-menu-item';
import WritingMenu from '../writing-menu';

const ariaClosed = __( 'Show more tools & options' );
const ariaOpen = __( 'Hide more tools & options' );

const MoreMenu = () => (
<Dropdown
className="edit-post-more-menu"
Expand All @@ -22,7 +25,7 @@ const MoreMenu = () => (
renderToggle={ ( { isOpen, onToggle } ) => (
<IconButton
icon="ellipsis"
label={ _x( 'More', 'button to expand options' ) }
label={ isOpen ? ariaOpen : ariaClosed }
onClick={ onToggle }
aria-expanded={ isOpen }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ exports[`MoreMenu should match snapshot 1`] = `
<IconButton
aria-expanded={false}
icon="ellipsis"
label="More"
label="Show more tools & options"
onClick={[Function]}
>
<Tooltip
text="More"
text="Show more tools & options"
>
<Button
aria-expanded={false}
aria-label="More"
aria-label="Show more tools & options"
className="components-icon-button"
onBlur={[Function]}
onClick={[Function]}
Expand All @@ -33,7 +33,7 @@ exports[`MoreMenu should match snapshot 1`] = `
>
<button
aria-expanded={false}
aria-label="More"
aria-label="Show more tools & options"
className="components-button components-icon-button"
onBlur={[Function]}
onClick={[Function]}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/adding-blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe( 'adding blocks', () => {
await page.keyboard.type( 'Second paragraph' );

// Switch to Text Mode to check HTML Output
await page.click( '.edit-post-more-menu [aria-label="More"]' );
await page.click( '.edit-post-more-menu [aria-label="Show more tools & options"]' );
const codeEditorButton = ( await page.$x( "//button[contains(text(), 'Code Editor')]" ) )[ 0 ];
await codeEditorButton.click( 'button' );

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/nux.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe( 'New User Experience (NUX)', () => {
await clickAllTips( page );

// Open the "More" menu to check the "Show Tips" element.
await page.click( '.edit-post-more-menu [aria-label="More"]' );
await page.click( '.edit-post-more-menu [aria-label="Show more tools & options"]' );
const showTipsButton = await page.$x( '//button[contains(text(), "Show Tips")][@aria-pressed="false"]' );

expect( showTipsButton ).toHaveLength( 1 );
Expand All @@ -136,7 +136,7 @@ describe( 'New User Experience (NUX)', () => {
await clickOnMoreMenuItem( 'Show Tips' );

// Open the "More" menu to check the "Show Tips" element.
await page.click( '.edit-post-more-menu [aria-label="More"]' );
await page.click( '.edit-post-more-menu [aria-label="Show more tools & options"]' );
const showTipsButton = await page.$x( '//button[contains(text(), "Show Tips")][@aria-pressed="true"]' );

expect( showTipsButton ).toHaveLength( 1 );
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export async function waitForPageDimensions( width, height ) {
}

export async function switchToEditor( mode ) {
await page.click( '.edit-post-more-menu [aria-label="More"]' );
await page.click( '.edit-post-more-menu [aria-label="Show more tools & options"]' );
const [ button ] = await page.$x( `//button[contains(text(), '${ mode } Editor')]` );
await button.click( 'button' );
}
Expand Down Expand Up @@ -306,7 +306,7 @@ export async function pressWithModifier( modifiers, key ) {
* @param {string} buttonLabel The label to search the button for.
*/
export async function clickOnMoreMenuItem( buttonLabel ) {
await expect( page ).toClick( '.edit-post-more-menu [aria-label="More"]' );
await expect( page ).toClick( '.edit-post-more-menu [aria-label="Show more tools & options"]' );
await page.click( `.edit-post-more-menu__content button[aria-label="${ buttonLabel }"]` );
}

Expand Down