2021-12-11 23:26:58 +00:00
|
|
|
import { getCustomIcon } from '../lib';
|
|
|
|
|
2022-01-09 20:44:48 +00:00
|
|
|
const svg =
|
|
|
|
'<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"><circle cx="60" cy="60" r="50"/></svg>';
|
2021-12-11 23:26:58 +00:00
|
|
|
|
|
|
|
describe('Testing getCustomIcon', () => {
|
2022-01-09 20:44:48 +00:00
|
|
|
test('CustomIconLoader', async () => {
|
|
|
|
const result = await getCustomIcon(() => svg, 'a', 'b');
|
2021-12-11 23:26:58 +00:00
|
|
|
expect(svg).toEqual(result);
|
|
|
|
});
|
2022-01-09 20:44:48 +00:00
|
|
|
|
|
|
|
test('CustomIconLoader with transform', async () => {
|
|
|
|
const result = await getCustomIcon(
|
|
|
|
() => svg,
|
|
|
|
'a',
|
|
|
|
'b',
|
|
|
|
(icon) => {
|
|
|
|
return icon.replace('<svg ', '<svg width="1em" height="1em" ');
|
|
|
|
}
|
|
|
|
);
|
2021-12-11 23:26:58 +00:00
|
|
|
expect(result && result.indexOf('width="1em"') > -1).toBeTruthy();
|
|
|
|
expect(result && result.indexOf('height="1em"') > -1).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|