2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-13 22:18:24 +00:00
iconify/packages/utils/spec/svg/replaceIDsSpec.mjs

15 lines
443 B
JavaScript
Raw Normal View History

2021-09-20 20:53:49 +00:00
import { replaceIDs } from '@iconify/utils/lib/svg/id';
describe('Testing replaceIDs', () => {
it('Simple code', () => {
const body =
'<defs><path id="test1"></defs><use fill="#FFA000" xlink:href="#test1"/>';
const expected =
'<defs><path id="callback0"></defs><use fill="#FFA000" xlink:href="#callback0"/>';
// Using callback
let counter = 0;
expect(replaceIDs(body, () => 'callback' + counter++)).toBe(expected);
});
2021-09-20 20:53:49 +00:00
});