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', () => {
|
2021-05-24 10:25:02 +00:00
|
|
|
// Short icon
|
|
|
|
const result1 = getIconData(
|
|
|
|
{
|
|
|
|
prefix: 'foo',
|
|
|
|
icons: {
|
|
|
|
bar: {
|
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'bar',
|
|
|
|
false
|
|
|
|
);
|
2021-09-20 20:53:49 +00:00
|
|
|
expect(result1).toEqual({
|
2021-05-24 10:25:02 +00:00
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Full icon
|
|
|
|
const result2 = getIconData(
|
|
|
|
{
|
|
|
|
prefix: 'foo',
|
|
|
|
icons: {
|
|
|
|
bar: {
|
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'bar',
|
|
|
|
true
|
|
|
|
);
|
2021-09-20 20:53:49 +00:00
|
|
|
expect(result2).toEqual({
|
2021-05-24 10:25:02 +00:00
|
|
|
body: '<g />',
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
width: 24,
|
|
|
|
height: 16,
|
|
|
|
rotate: 0,
|
|
|
|
vFlip: false,
|
|
|
|
hFlip: false,
|
|
|
|
});
|
|
|
|
});
|
2021-05-27 16:52:31 +00:00
|
|
|
|
2021-09-20 20:53:49 +00:00
|
|
|
test('Minified icon set', () => {
|
2021-05-27 16:52:31 +00:00
|
|
|
// Short icon
|
|
|
|
const result1 = getIconData(
|
|
|
|
{
|
|
|
|
prefix: 'foo',
|
|
|
|
icons: {
|
|
|
|
bar: {
|
|
|
|
body: '<g />',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
},
|
|
|
|
'bar',
|
|
|
|
false
|
|
|
|
);
|
2021-09-20 20:53:49 +00:00
|
|
|
expect(result1).toEqual({
|
2021-05-27 16:52:31 +00:00
|
|
|
body: '<g />',
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Full icon
|
|
|
|
const result2 = getIconData(
|
|
|
|
{
|
|
|
|
prefix: 'foo',
|
|
|
|
icons: {
|
|
|
|
bar: {
|
|
|
|
body: '<g />',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
},
|
|
|
|
'bar',
|
|
|
|
true
|
|
|
|
);
|
2021-09-20 20:53:49 +00:00
|
|
|
expect(result2).toEqual({
|
2021-05-27 16:52:31 +00:00
|
|
|
body: '<g />',
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
rotate: 0,
|
|
|
|
vFlip: false,
|
|
|
|
hFlip: false,
|
|
|
|
});
|
|
|
|
});
|
2021-05-24 10:25:02 +00:00
|
|
|
});
|