Skip to content

Commit

Permalink
fix(menu-separator): add className prop to MenuSeparator (#2949)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Trevor <7311041+tjuanitas@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 14, 2022
1 parent 722296d commit b9503b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/menu/MenuSeparator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import React from 'react';
import classNames from 'classnames';

const MenuSeparator = () => <li role="separator" />;
export interface MenuSeparatorProps {
className?: string;
}

const MenuSeparator = ({ className }: MenuSeparatorProps) => (
<li className={classNames('bdl-MenuSeparator', className)} role="separator" />
);

export default MenuSeparator;
9 changes: 9 additions & 0 deletions src/components/menu/__tests__/MenuSeparator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@ describe('components/menu/MenuSeparator', () => {

expect(wrapper.is('li')).toBe(true);
expect(wrapper.prop('role')).toEqual('separator');
expect(wrapper.prop('className')).toEqual('bdl-MenuSeparator');
});

test('should correctly render a separator list element when className is provided', () => {
const wrapper = shallow(<MenuSeparator className="hello-world" />);

expect(wrapper.is('li')).toBe(true);
expect(wrapper.prop('role')).toEqual('separator');
expect(wrapper.prop('className')).toEqual('bdl-MenuSeparator hello-world');
});
});

0 comments on commit b9503b8

Please sign in to comment.