import React from 'react'; import { Icon, InlineIcon } from '../../dist/offline'; import renderer from 'react-test-renderer'; const iconData = { body: '', width: 24, height: 24, }; describe('Passing attributes', () => { test('title', () => { const component = renderer.create( ); const tree = component.toJSON(); expect(tree.props.title).toStrictEqual('Icon!'); }); test('aria-hidden', () => { // dashes, string value const component = renderer.create( ); const tree = component.toJSON(); expect(tree.props['aria-hidden']).toStrictEqual(void 0); }); test('ariaHidden', () => { // camelCase, boolean value const component = renderer.create( ); const tree = component.toJSON(); expect(tree.props['aria-hidden']).toStrictEqual(void 0); }); test('style', () => { const component = renderer.create( ); const tree = component.toJSON(); expect(tree.props.style).toMatchObject({ verticalAlign: '0', color: 'red', }); }); test('color', () => { const component = renderer.create(); const tree = component.toJSON(); expect(tree.props.style).toMatchObject({ color: 'red', }); }); test('color with style', () => { const component = renderer.create( ); const tree = component.toJSON(); // `style` overrides `color` expect(tree.props.style).toMatchObject({ color: 'green', }); }); test('attributes that cannot change', () => { const component = renderer.create( ); const tree = component.toJSON(); expect(tree.props.viewBox).toStrictEqual('0 0 24 24'); }); });