forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsvg-icon.test.tsx
More file actions
40 lines (31 loc) · 1.08 KB
/
svg-icon.test.tsx
File metadata and controls
40 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import { render } from '@testing-library/react';
import { SVGIcon, IconProps } from '../../src/svg-icon';
describe('SVGIcon', () => {
it('should render SVG element with correct size', () => {
const iconProps: IconProps & {
viewBox: string;
} = {
size: 'small',
viewBox: '0 0 24 24',
};
const { container } = render(<SVGIcon {...iconProps} />);
const svgElement = container.querySelector('svg');
console.log(svgElement)
expect(svgElement?.getAttribute('width')).toEqual('12');
expect(svgElement?.getAttribute('height')).toEqual('12');
});
it('should render SVG element with custom size', () => {
const iconProps: IconProps & {
viewBox: string;
} = {
size: 24,
viewBox: '0 0 24 24',
};
const { container } = render(<SVGIcon {...iconProps} />);
const svgElement = container.querySelector('svg');
expect(svgElement?.getAttribute('width')).toEqual('24');
expect(svgElement?.getAttribute('height')).toEqual('24');
});
// Add more tests for other scenarios if needed
});