import { render } from '@testing-library/svelte';
import { Icon } from '../../dist/offline';
const iconDataWithID = {
body:
'',
width: 128,
height: 128,
};
describe('Replacing IDs', () => {
test('default behavior', () => {
const component = render(Icon, { icon: iconDataWithID });
const node = component.container.querySelector('svg');
// Check that default id doesn't exist
const path = node.getElementById('ssvg-id-1st-place-medala');
expect(path).toBeNull();
});
test('custom generator', () => {
const component = render(Icon, { icon: iconDataWithID, id: 'test' });
const node = component.container.querySelector('svg');
// Check that ID 'testa' exists
const path = node.getElementById('test-0');
expect(path).toBeTruthy();
});
});