Lade Bilder aus E-Mails auf Wunsch über den Server nach und verkleinere den Kopf der Leseansicht auf dem Handy.
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 5m32s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 21s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
StommerandClaude Sonnet 5.5 committed 2026-10-22 16:47:24 +02:00
1 parent 075525ee17
commit a3f328832e
11 files changed
+365 -11

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import assert from "node:assert/strict";
import test from "node:test";
import { IMAGE_KEYS, deviceClass, readImageChoice, writeImageChoice } from "./mail-images.js";
function memory() {
const data = {};
return { getItem: (key) => (key in data ? data[key] : null), setItem: (key, value) => { data[key] = value; } };
}
test("pictures are asked for by default and the choice is kept per device kind", () => {
const store = memory();
assert.equal(readImageChoice("touch", store), "ask");
assert.equal(writeImageChoice("desktop", "auto", store), "auto");
assert.equal(readImageChoice("desktop", store), "auto");
assert.equal(readImageChoice("touch", store), "ask");
assert.equal(writeImageChoice("touch", "anything", store), "ask");
assert.ok(IMAGE_KEYS.desktop !== IMAGE_KEYS.touch);
});
test("a blocked store and a missing media query fall back to the safe choice", () => {
const broken = { getItem() { throw new Error("blocked"); }, setItem() { throw new Error("blocked"); } };
assert.equal(readImageChoice("desktop", broken), "ask");
assert.equal(writeImageChoice("desktop", "auto", broken), "auto");
assert.equal(readImageChoice("desktop", null), "ask");
assert.equal(deviceClass(null), "desktop");
assert.equal(deviceClass(function () { return { matches: true }; }), "touch");
assert.equal(deviceClass(function () { throw new Error("x"); }), "desktop");
});