Restore compact maskable PWA icon

This commit is contained in:
2026-11-02 21:16:49 -08:00
parent 4b1b606563
commit 9e4811b6cc
3 changed files with 24 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+6
View File
@@ -20,6 +20,12 @@
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icons/icon-maskable-compact-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
+18
View File
@@ -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);
});