File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { render } from '@testing-library/react' ;
2+ import { CodeIcon } from '../icons' ;
3+
4+ describe ( 'CodeIcon' , ( ) => {
5+ it ( 'renders without errors' , ( ) => {
6+ render ( < CodeIcon width = { 24 } height = { 24 } /> ) ;
7+ } ) ;
8+
9+ it ( 'applies width and height' , ( ) => {
10+ const { getByTestId } = render ( < CodeIcon width = { 24 } height = { 24 } /> ) ;
11+ const svgElement = getByTestId ( 'code-icon-svg' ) ;
12+ expect ( svgElement . getAttribute ( 'width' ) ) . toBe ( '24' ) ;
13+ expect ( svgElement . getAttribute ( 'height' ) ) . toBe ( '24' ) ;
14+ } ) ;
15+ } ) ;
Original file line number Diff line number Diff line change 1+ import { DEFAULT_HEIGHT , DEFAULT_WIDTH , DEFAULT_FILL_NONE } from '../../constants/constants' ;
2+ import { IconProps } from '../types' ;
3+
4+ export const CodeIcon = ( {
5+ width = DEFAULT_WIDTH ,
6+ height = DEFAULT_HEIGHT ,
7+ fill = DEFAULT_FILL_NONE ,
8+ ...props
9+ } : IconProps ) : JSX . Element => {
10+ return (
11+ < svg
12+ width = { width }
13+ height = { height }
14+ xmlns = "http://www.w3.org/2000/svg"
15+ viewBox = "0 0 24 24"
16+ data-testid = "code-icon-svg"
17+ { ...props }
18+ >
19+ < path
20+ d = "M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"
21+ fill = { fill }
22+ />
23+ </ svg >
24+ ) ;
25+ } ;
26+
27+ export default CodeIcon ;
Original file line number Diff line number Diff line change 1+ export { default as CodeIcon } from './CodeIcon' ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export * from './Circle';
3232export * from './Clone' ;
3333export * from './Close' ;
3434export * from './Cloud' ;
35+ export * from './Code' ;
3536export * from './CollapseAll' ;
3637export * from './Column' ;
3738export * from './CompareArrows' ;
You can’t perform that action at this time.
0 commit comments