2021-05-26 07:01:23 +00:00
|
|
|
import { getIconData } from '../lib/icon-set/get-icon';
|
2021-05-24 10:25:02 +00:00
|
|
|
|
|
|
|
describe('Testing getting icon data', () => {
|
2021-09-20 20:53:49 +00:00
|
|
|
test('Simple icon', () => {
|
2022-07-01 20:09:53 +00:00
|
|
|
const result = getIconData(
|
2021-05-24 10:25:02 +00:00
|
|
|
{
|
|
|
|
prefix: 'foo',
|
|
|
|
icons: {
|
|
|
|
bar: {
|
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-07-01 20:09:53 +00:00
|
|
|
'bar'
|
2021-05-24 10:25:02 +00:00
|
|
|
);
|
2022-07-01 20:09:53 +00:00
|
|
|
expect(result).toEqual({
|
2021-05-24 10:25:02 +00:00
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
});
|
|
|
|
});
|
2021-05-27 16:52:31 +00:00
|
|
|
|
2021-09-20 20:53:49 +00:00
|
|
|
test('Minified icon set', () => {
|
2022-07-01 20:09:53 +00:00
|
|
|
const result = getIconData(
|
2021-05-27 16:52:31 +00:00
|
|
|
{
|
2024-11-02 07:12:14 +00:00
|
|
|
prefix: 'test_set',
|
2021-05-27 16:52:31 +00:00
|
|
|
icons: {
|
2024-11-02 07:12:14 +00:00
|
|
|
test_icon: {
|
2021-05-27 16:52:31 +00:00
|
|
|
body: '<g />',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
},
|
2024-11-02 07:12:14 +00:00
|
|
|
'test_icon'
|
|
|
|
);
|
|
|
|
expect(result).toEqual({
|
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Alias', () => {
|
|
|
|
const result = getIconData(
|
|
|
|
{
|
|
|
|
prefix: 'test_set',
|
|
|
|
icons: {
|
|
|
|
test_icon: {
|
|
|
|
body: '<g />',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
aliases: {
|
|
|
|
test_alias: {
|
|
|
|
parent: 'test_icon',
|
|
|
|
rotate: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
},
|
|
|
|
'test_alias'
|
2021-05-27 16:52:31 +00:00
|
|
|
);
|
2022-07-01 20:09:53 +00:00
|
|
|
expect(result).toEqual({
|
2021-05-27 16:52:31 +00:00
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
2024-11-02 07:12:14 +00:00
|
|
|
rotate: 2,
|
2021-05-27 16:52:31 +00:00
|
|
|
});
|
|
|
|
});
|
2021-05-24 10:25:02 +00:00
|
|
|
});
|