Skip to content

Commit b9592a9

Browse files
committed
[Feature] Add MoreHorizIcon
Signed-off-by: thechillbasu <basusarthakmain@gmail.com>
1 parent d9e653c commit b9592a9

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { render } from '@testing-library/react';
2+
import { MoreHorizIcon } from '../icons';
3+
4+
describe('MoreHorizIcon', () => {
5+
it('renders without errors', () => {
6+
render(<MoreHorizIcon />);
7+
});
8+
9+
it('uses default width and height', () => {
10+
const { getByTestId } = render(<MoreHorizIcon />);
11+
const svgElement = getByTestId('more-horiz-icon-svg');
12+
expect(svgElement.getAttribute('width')).toBe('24');
13+
expect(svgElement.getAttribute('height')).toBe('24');
14+
});
15+
16+
it('applies custom width and height', () => {
17+
const { getByTestId } = render(<MoreHorizIcon width={32} height={32} />);
18+
const svgElement = getByTestId('more-horiz-icon-svg');
19+
expect(svgElement.getAttribute('width')).toBe('32');
20+
expect(svgElement.getAttribute('height')).toBe('32');
21+
});
22+
23+
it('renders with a title for accessibility', () => {
24+
const { container } = render(<MoreHorizIcon title="More options" />);
25+
const titleElement = container.querySelector('title');
26+
expect(titleElement).not.toBeNull();
27+
expect(titleElement?.textContent).toBe('More options');
28+
});
29+
30+
it('does not render a title when not provided', () => {
31+
const { container } = render(<MoreHorizIcon />);
32+
const titleElement = container.querySelector('title');
33+
expect(titleElement).toBeNull();
34+
});
35+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_FILL_NONE } from '../../constants/constants';
2+
import { IconProps } from '../types';
3+
4+
const MoreHorizIcon = ({
5+
width = DEFAULT_WIDTH,
6+
height = DEFAULT_HEIGHT,
7+
fill = DEFAULT_FILL_NONE,
8+
title,
9+
...props
10+
}: IconProps): JSX.Element => {
11+
return (
12+
<svg
13+
width={width}
14+
height={height}
15+
xmlns="http://www.w3.org/2000/svg"
16+
viewBox="0 0 24 24"
17+
data-testid="more-horiz-icon-svg"
18+
{...props}
19+
>
20+
{title && <title>{title}</title>}
21+
<path
22+
d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
23+
fill={fill}
24+
/>
25+
</svg>
26+
);
27+
};
28+
29+
export default MoreHorizIcon;

src/icons/MoreHoriz/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as MoreHorizIcon } from './MoreHorizIcon';

src/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export * from './MesheryFilter';
116116
export * from './MesheryOperator';
117117
export * from './Mesh';
118118
export { default as ModifiedApplicationFileIcon } from './ModifiedApplicationFileIcon';
119+
export * from './MoreHoriz';
119120
export * from './MoreVert';
120121
export * from './MoveFile';
121122
export * from './Open';

0 commit comments

Comments
 (0)