|
1 | 1 | import React, { createRef } from 'react'; |
2 | 2 | import { render } from '@testing-library/react'; |
3 | | -import { IconClose, IconPlus, IconSearch, IconHeart, IconStar, withSpin } from '../index'; |
| 3 | +import { IconClose, IconPlus, IconSearch, IconHeart, IconStar } from '../index'; |
4 | 4 |
|
5 | 5 | const sampleIcons = [ |
6 | 6 | { name: 'IconClose', Component: IconClose }, |
@@ -73,44 +73,3 @@ describe('Icon components', () => { |
73 | 73 | }); |
74 | 74 |
|
75 | 75 | }); |
76 | | - |
77 | | -describe('withSpin HOC', () => { |
78 | | - const SpinClose = withSpin(IconClose); |
79 | | - |
80 | | - it('applies spin animation style', () => { |
81 | | - const { container } = render(<SpinClose />); |
82 | | - const svg = container.querySelector('svg')!; |
83 | | - expect(svg.style.animation).toBe('tiny-icon-spin 1s linear infinite'); |
84 | | - }); |
85 | | - |
86 | | - it('injects keyframes style tag into document head', () => { |
87 | | - render(<SpinClose />); |
88 | | - const styleEl = document.getElementById('__tiny_icon_spin__'); |
89 | | - expect(styleEl).toBeTruthy(); |
90 | | - expect(styleEl!.textContent).toContain('@keyframes tiny-icon-spin'); |
91 | | - }); |
92 | | - |
93 | | - it('passes through icon props', () => { |
94 | | - const { container } = render(<SpinClose size={24} color="red" />); |
95 | | - const svg = container.querySelector('svg')!; |
96 | | - expect(svg.getAttribute('width')).toBe('24'); |
97 | | - expect(svg.getAttribute('fill')).toBe('red'); |
98 | | - }); |
99 | | - |
100 | | - it('merges custom style with spin animation', () => { |
101 | | - const { container } = render(<SpinClose style={{ color: 'red' }} />); |
102 | | - const svg = container.querySelector('svg')!; |
103 | | - expect(svg.style.animation).toBe('tiny-icon-spin 1s linear infinite'); |
104 | | - expect(svg.style.color).toBe('red'); |
105 | | - }); |
106 | | - |
107 | | - it('forwards ref', () => { |
108 | | - const ref = createRef<SVGSVGElement>(); |
109 | | - render(<SpinClose ref={ref} />); |
110 | | - expect(ref.current).toBeInstanceOf(SVGSVGElement); |
111 | | - }); |
112 | | - |
113 | | - it('sets displayName', () => { |
114 | | - expect(SpinClose.displayName).toBe('withSpin(IconClose)'); |
115 | | - }); |
116 | | -}); |
0 commit comments