import { render } from '@testing-library/svelte'; import { Icon } from '../../dist/offline'; const iconData = { body: '', width: 24, height: 24, }; describe('Dimensions', () => { test('height', () => { const component = render(Icon, { icon: iconData, height: '48' }); const node = component.container.querySelector('svg'); expect(node.getAttribute('height')).toEqual('48'); expect(node.getAttribute('width')).toEqual('48'); }); test('width and height', () => { const component = render(Icon, { icon: iconData, // Mixing numbers and strings width: 32, height: '48', }); const node = component.container.querySelector('svg'); expect(node.getAttribute('height')).toEqual('48'); expect(node.getAttribute('width')).toEqual('32'); }); test('auto', () => { const component = render(Icon, { icon: iconData, height: 'auto', }); const node = component.container.querySelector('svg'); expect(node.getAttribute('height')).toEqual('24'); expect(node.getAttribute('width')).toEqual('24'); }); });