/** * @jest-environment jsdom */ import { render } from '@testing-library/svelte'; // Test importing from exports import Icon from '../../offline'; const iconData = { body: '', width: 24, height: 24, }; describe('Creating component', () => { test('basic icon', () => { const component = render(Icon, { icon: iconData }); const node = component.container.querySelector('svg')!; const html = (node.parentNode as HTMLDivElement).innerHTML; // Check HTML expect(html.replace(//gm, '')).toBe( '' ); // Make sure getAttribute() works, used in other tests expect(node.getAttribute('xmlns')).toBe('http://www.w3.org/2000/svg'); expect(node.getAttribute('aria-hidden')).toBe('true'); // Make sure style exists const style = node.style; expect(typeof style).toBe('object'); }); });