diff --git a/src/components/media/Media.md b/src/components/media/Media.md index 507b9c3514e..a88e50fb190 100644 --- a/src/components/media/Media.md +++ b/src/components/media/Media.md @@ -17,7 +17,7 @@ const { MenuItem } = require('../menu'); - + Edit Delete diff --git a/src/components/media/MediaMenu.js b/src/components/media/MediaMenu.js index 54d4b61bed8..13124f5e100 100644 --- a/src/components/media/MediaMenu.js +++ b/src/components/media/MediaMenu.js @@ -15,13 +15,15 @@ type Props = { className?: string, /** is the dropdown menu button disabled */ isDisabled: boolean, + /** aria-label prop for button icon */ + label?: string, }; -function MediaMenu({ className, children, isDisabled = false, ...rest }: Props) { +function MediaMenu({ className, children, isDisabled = false, label, ...rest }: Props) { return (
- + {children} diff --git a/src/components/media/__tests__/MediaMenu-test.js b/src/components/media/__tests__/MediaMenu-test.js new file mode 100644 index 00000000000..ee8ec2b43c7 --- /dev/null +++ b/src/components/media/__tests__/MediaMenu-test.js @@ -0,0 +1,11 @@ +import React from 'react'; + +import MediaMenu from '../MediaMenu'; + +describe('components/Media/MediaMenu', () => { + test('label prop adds aria-label attribute to menu button', () => { + const label = 'Open options'; + const wrapper = shallow(); + expect(wrapper.find('PlainButton').prop('aria-label')).toBe(label); + }); +});