2022-03-04 00:36:30 +01:00
|
|
|
import { FileSystemIconLoader } from '../lib/loader/node-loaders';
|
|
|
|
|
|
|
|
const fixturesDir = './tests/fixtures';
|
2022-03-02 18:55:03 +01:00
|
|
|
|
|
|
|
describe('Testing FileSystemIconLoader', () => {
|
|
|
|
test('FileSystemIconLoader', async () => {
|
2022-03-14 15:39:40 +01:00
|
|
|
const result = await FileSystemIconLoader(fixturesDir)('circle');
|
2022-03-02 18:55:03 +01:00
|
|
|
expect(result && result.indexOf('svg') > -1).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2022-06-17 22:10:54 +02:00
|
|
|
test('FileSystemIconLoader cleanups svg preface', async () => {
|
|
|
|
const result = await FileSystemIconLoader(fixturesDir)(
|
|
|
|
'circle-xml-preface'
|
|
|
|
);
|
|
|
|
expect(result && result.indexOf('<svg') === 0).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2022-03-02 18:55:03 +01:00
|
|
|
test('FileSystemIconLoader with transform', async () => {
|
2022-03-14 15:39:40 +01:00
|
|
|
const result = await FileSystemIconLoader(fixturesDir, (icon) => {
|
2023-01-06 14:43:22 +02:00
|
|
|
return icon.replace(/<svg\s+/, '<svg width="1em" height="1em" ');
|
2022-03-14 15:39:40 +01:00
|
|
|
})('circle');
|
2022-03-02 18:55:03 +01:00
|
|
|
expect(result && result.indexOf('width="1em"') > -1).toBeTruthy();
|
|
|
|
expect(result && result.indexOf('height="1em"') > -1).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|