import React from 'react'; import { Icon, InlineIcon } from '../../dist/offline'; import renderer from 'react-test-renderer'; const iconData = { body: '', width: 24, height: 24, }; describe('Creating component', () => { test('basic icon', () => { const component = renderer.create(); const tree = component.toJSON(); expect(tree).toMatchObject({ type: 'svg', props: { 'xmlns': 'http://www.w3.org/2000/svg', 'xmlnsXlink': 'http://www.w3.org/1999/xlink', 'aria-hidden': true, 'role': 'img', 'style': {}, 'dangerouslySetInnerHTML': { __html: iconData.body, }, 'width': '1em', 'height': '1em', 'viewBox': '0 0 ' + iconData.width + ' ' + iconData.height, }, children: null, }); }); test('inline icon', () => { const component = renderer.create(); const tree = component.toJSON(); expect(tree).toMatchObject({ type: 'svg', props: { 'xmlns': 'http://www.w3.org/2000/svg', 'xmlnsXlink': 'http://www.w3.org/1999/xlink', 'aria-hidden': true, 'role': 'img', 'style': { verticalAlign: '-0.125em', }, 'dangerouslySetInnerHTML': { __html: iconData.body, }, 'width': '1em', 'height': '1em', 'viewBox': '0 0 ' + iconData.width + ' ' + iconData.height, }, children: null, }); }); });