mirror of
https://github.com/iconify/iconify.git
synced 2025-01-08 15:54:09 +00:00
Add lastModified to getIcons result
This commit is contained in:
parent
d72a580214
commit
8b034b290e
@ -27,6 +27,12 @@ export function getIcons(
|
|||||||
const sourceIcons = data.icons;
|
const sourceIcons = data.icons;
|
||||||
const sourceAliases = data.aliases || {};
|
const sourceAliases = data.aliases || {};
|
||||||
|
|
||||||
|
// Add lastModified
|
||||||
|
if (data.lastModified) {
|
||||||
|
result.lastModified = data.lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get dependencies tree
|
||||||
const tree = getIconsTree(data, names);
|
const tree = getIconsTree(data, names);
|
||||||
let empty = true;
|
let empty = true;
|
||||||
|
|
||||||
|
@ -61,9 +61,11 @@ describe('Testing retrieving icons from icon set', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Aliases and characters', () => {
|
test('Aliases, characters, lastModified', () => {
|
||||||
|
const lastModified = 12345;
|
||||||
const data: IconifyJSON = {
|
const data: IconifyJSON = {
|
||||||
prefix: 'foo',
|
prefix: 'foo',
|
||||||
|
lastModified,
|
||||||
icons: {
|
icons: {
|
||||||
bar: {
|
bar: {
|
||||||
body: '<g />',
|
body: '<g />',
|
||||||
@ -96,6 +98,7 @@ describe('Testing retrieving icons from icon set', () => {
|
|||||||
// Alias
|
// Alias
|
||||||
expect(getIcons(data, ['foo'])).toEqual({
|
expect(getIcons(data, ['foo'])).toEqual({
|
||||||
prefix: 'foo',
|
prefix: 'foo',
|
||||||
|
lastModified,
|
||||||
icons: {
|
icons: {
|
||||||
bar: {
|
bar: {
|
||||||
body: '<g />',
|
body: '<g />',
|
||||||
@ -112,6 +115,7 @@ describe('Testing retrieving icons from icon set', () => {
|
|||||||
// Alias of alias
|
// Alias of alias
|
||||||
expect(getIcons(data, ['foo2'])).toEqual({
|
expect(getIcons(data, ['foo2'])).toEqual({
|
||||||
prefix: 'foo',
|
prefix: 'foo',
|
||||||
|
lastModified,
|
||||||
icons: {
|
icons: {
|
||||||
bar: {
|
bar: {
|
||||||
body: '<g />',
|
body: '<g />',
|
||||||
@ -132,6 +136,7 @@ describe('Testing retrieving icons from icon set', () => {
|
|||||||
expect(getIcons(data, ['missing-alias'])).toBeNull();
|
expect(getIcons(data, ['missing-alias'])).toBeNull();
|
||||||
expect(getIcons(data, ['missing-alias'], true)).toEqual({
|
expect(getIcons(data, ['missing-alias'], true)).toEqual({
|
||||||
prefix: 'foo',
|
prefix: 'foo',
|
||||||
|
lastModified,
|
||||||
icons: {},
|
icons: {},
|
||||||
not_found: ['missing-alias'],
|
not_found: ['missing-alias'],
|
||||||
});
|
});
|
||||||
@ -146,6 +151,7 @@ describe('Testing retrieving icons from icon set', () => {
|
|||||||
expect(getIcons(data, ['f04'])).toBeNull();
|
expect(getIcons(data, ['f04'])).toBeNull();
|
||||||
expect(getIcons(data, ['f04'], true)).toEqual({
|
expect(getIcons(data, ['f04'], true)).toEqual({
|
||||||
prefix: 'foo',
|
prefix: 'foo',
|
||||||
|
lastModified,
|
||||||
icons: {},
|
icons: {},
|
||||||
not_found: ['f04'],
|
not_found: ['f04'],
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user