Restore compact maskable PWA icon
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -20,6 +20,12 @@
|
|||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/icons/icon-maskable-compact-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
|
import test from 'node:test';
|
||||||
|
|
||||||
|
test('PWA icons include a compact adaptive icon', async () => {
|
||||||
|
const manifest = JSON.parse(await readFile(new URL('../public/manifest.webmanifest', import.meta.url), 'utf8'));
|
||||||
|
for (const size of ['192x192', '512x512']) {
|
||||||
|
assert.ok(manifest.icons.some(icon => icon.sizes === size && (icon.purpose ?? 'any').split(/\s+/).includes('any')));
|
||||||
|
}
|
||||||
|
const maskable = manifest.icons.filter(icon => (icon.purpose ?? 'any').split(/\s+/).includes('maskable'));
|
||||||
|
assert.equal(maskable.length, 1);
|
||||||
|
assert.equal(maskable[0].sizes, '512x512');
|
||||||
|
assert.equal(maskable[0].type, 'image/png');
|
||||||
|
const image = await readFile(new URL(`../public${maskable[0].src}`, import.meta.url));
|
||||||
|
assert.ok(image.length <= 32 * 1024);
|
||||||
|
assert.equal(image.readUInt32BE(16), 512);
|
||||||
|
assert.equal(image.readUInt32BE(20), 512);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user