import { render } from '@testing-library/svelte';
import { Icon } from '../../dist/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.innerHTML;
// Check HTML
expect(html).toEqual(
''
);
// Make sure getAttribute() works, used in other tests
expect(node.getAttribute('xmlns')).toEqual(
'http://www.w3.org/2000/svg'
);
expect(node.getAttribute('aria-hidden')).toEqual('true');
// Make sure style exists
const style = node.style;
expect(typeof style).toEqual('object');
});
});