UNPKG

@kadconsulting/dry

Version:
64 lines 4.09 kB
import { jsx as _jsx } from "react/jsx-runtime"; import Icon from '../../Icon/Icon'; import { Fingerprint03 } from './Fingerprint03'; import { IconSizes } from '../../Icon/IconTypes'; import { render, screen } from '@testing-library/react'; describe('Fingerprint03 icon path', () => { it('renders with a dry-prepended className', () => { // ARRANGE const { container } = render(_jsx(Icon, { size: IconSizes.SMALL, Path: Fingerprint03 })); // ASSERT /** Some icons consist of multiple paths; those that have multiple are grouped with a <g> element */ const pathOrGroup = container.firstElementChild?.children[1]; expect(Array.from(pathOrGroup?.classList ?? []).includes('dry-icon-fingerprint-03')).toBeTruthy(); }); it('renders the correct defaults', () => { // ARRANGE const { container } = render(_jsx(Icon, { Path: Fingerprint03 })); /** Some icons consist of multiple paths; those that have multiple are grouped with a <g> element */ const pathOrGroup = container.firstElementChild?.children[1]; expect(pathOrGroup).toHaveAttribute('stroke', '#000'); expect(pathOrGroup).toHaveAttribute('stroke-width', '2'); expect(pathOrGroup).toHaveAttribute('stroke-linecap', 'round'); expect(pathOrGroup).toHaveAttribute('stroke-linejoin', 'round'); }); it('renders the correct accessibility title', () => { // ARRANGE render(_jsx(Icon, { Path: Fingerprint03 })); // ASSERT expect(screen.getByTitle('fingerprint-03')).toBeInTheDocument(); }); it('renders with the consumer-specified stroke color', () => { // ARRANGE const color = 'primary'; render(_jsx(Icon, { Path: Fingerprint03, PathProps: { stroke: 'primary', } })); // ASSERT /** Some icons consist of multiple paths; those that have multiple are grouped with a <g> element */ const pathOrGroup = screen.getByTitle('fingerprint-03').parentElement?.children[1]; expect(pathOrGroup).toHaveAttribute('stroke', `var(--${color})`); }); it('renders the correct path(s)', () => { // ARRANGE const { container } = render(_jsx(Icon, { Path: Fingerprint03 })); // ASSERT const path0 = container.firstElementChild?.children[1]; expect(path0).toHaveAttribute('d', 'M8.1 21.221a12.16 12.16 0 0 1-2.207-7.002 6.108 6.108 0 0 1 6.106-6.11 6.108 6.108 0 0 1 6.106 6.11'); const path1 = container.firstElementChild?.children[2]; expect(path1).toHaveAttribute('d', 'M8.1 21.221a12.16 12.16 0 0 1-2.207-7.002 6.108 6.108 0 0 1 6.106-6.11 6.108 6.108 0 0 1 6.106 6.11'); const path2 = container.firstElementChild?.children[3]; expect(path2).toHaveAttribute('d', 'M18.436 20.312c-.11.006-.218.016-.329.016a6.108 6.108 0 0 1-6.106-6.11'); const path3 = container.firstElementChild?.children[4]; expect(path3).toHaveAttribute('d', 'M18.436 20.312c-.11.006-.218.016-.329.016a6.108 6.108 0 0 1-6.106-6.11'); const path4 = container.firstElementChild?.children[5]; expect(path4).toHaveAttribute('d', 'M13.27 22a9.158 9.158 0 0 1-4.323-7.781 3.054 3.054 0 1 1 6.107 0 3.054 3.054 0 1 0 6.108 0c0-5.062-4.102-9.164-9.16-9.164-5.059 0-9.16 4.102-9.16 9.164 0 1.128.126 2.226.358 3.286'); const path5 = container.firstElementChild?.children[6]; expect(path5).toHaveAttribute('d', 'M13.27 22a9.158 9.158 0 0 1-4.323-7.781 3.054 3.054 0 1 1 6.107 0 3.054 3.054 0 1 0 6.108 0c0-5.062-4.102-9.164-9.16-9.164-5.059 0-9.16 4.102-9.16 9.164 0 1.128.126 2.226.358 3.286'); const path6 = container.firstElementChild?.children[7]; expect(path6).toHaveAttribute('d', 'M20.526 5.863A11.327 11.327 0 0 0 12 2a11.327 11.327 0 0 0-8.525 3.863'); const path7 = container.firstElementChild?.children[8]; expect(path7).toHaveAttribute('d', 'M20.526 5.863A11.327 11.327 0 0 0 12 2a11.327 11.327 0 0 0-8.525 3.863'); }); }); //# sourceMappingURL=Fingerprint03.test.js.map