UNPKG

@kadconsulting/dry

Version:
50 lines 2.96 kB
import { jsx as _jsx } from "react/jsx-runtime"; import Icon from '../../Icon/Icon'; import { BellRinging02 } from './BellRinging02'; import { IconSizes } from '../../Icon/IconTypes'; import { render, screen } from '@testing-library/react'; describe('BellRinging02 icon path', () => { it('renders with a dry-prepended className', () => { // ARRANGE const { container } = render(_jsx(Icon, { size: IconSizes.SMALL, Path: BellRinging02 })); // 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-bell-ringing-02')).toBeTruthy(); }); it('renders the correct defaults', () => { // ARRANGE const { container } = render(_jsx(Icon, { Path: BellRinging02 })); /** 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: BellRinging02 })); // ASSERT expect(screen.getByTitle('bell-ringing-02')).toBeInTheDocument(); }); it('renders with the consumer-specified stroke color', () => { // ARRANGE const color = 'primary'; render(_jsx(Icon, { Path: BellRinging02, PathProps: { stroke: 'primary', } })); // ASSERT /** Some icons consist of multiple paths; those that have multiple are grouped with a <g> element */ const pathOrGroup = screen.getByTitle('bell-ringing-02').parentElement?.children[1]; expect(pathOrGroup).toHaveAttribute('stroke', `var(--${color})`); }); it('renders the correct path(s)', () => { // ARRANGE const { container } = render(_jsx(Icon, { Path: BellRinging02 })); // ASSERT const path0 = container.firstElementChild?.children[1]; expect(path0).toHaveAttribute('d', 'M15 19a3 3 0 1 1-6 0m4.797-12.761a2.5 2.5 0 1 0-3.593 0M2.547 8.323a4.007 4.007 0 0 1 2.032-3.52m16.874 3.52a4.007 4.007 0 0 0-2.032-3.52m-1.42 6.397c0-1.38-.633-2.702-1.758-3.677C15.118 6.548 13.592 6 12 6c-1.591 0-3.117.548-4.242 1.523C6.632 8.498 6 9.821 6 11.2c0 2.282-.566 3.95-1.272 5.145-.804 1.36-1.207 2.041-1.19 2.204.017.186.05.244.202.355.131.096.794.096 2.118.096h12.284c1.325 0 1.987 0 2.119-.096.15-.11.184-.17.202-.355.016-.163-.386-.843-1.19-2.204C18.565 15.15 18 13.482 18 11.2Z'); }); }); //# sourceMappingURL=BellRinging02.test.js.map