No longer need the hack to only use them in components while URLs are used in styles since I don't need icons in the styles anymore. Embedding the markup also provides the option to restyle the icons
26 lines
617 B
JavaScript
26 lines
617 B
JavaScript
import React from 'react';
|
|
import renderer from 'react-test-renderer';
|
|
|
|
import Message from './Message';
|
|
|
|
test('Message rendering', () => {
|
|
const component = renderer.create(
|
|
<Message heading="Testing">
|
|
<p>Message content</p>
|
|
</Message>
|
|
);
|
|
let tree = component.toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|
|
|
|
test('Message rendering with icon', () => {
|
|
const Icon = () => 'Sample icon SVG';
|
|
const component = renderer.create(
|
|
<Message heading="Testing" icon={ Icon }>
|
|
<p>Message content</p>
|
|
</Message>
|
|
);
|
|
let tree = component.toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|