diff --git a/server/pruef-dogtag-seite.mjs b/server/pruef-dogtag-seite.mjs index 4980a843..f5560120 100644 --- a/server/pruef-dogtag-seite.mjs +++ b/server/pruef-dogtag-seite.mjs @@ -121,7 +121,7 @@ for (let i = 1; i <= 25; i++) d.prepare("INSERT INTO dogtag_heulen (person_id, t d.prepare("INSERT INTO spenden (betrag_cent, name, person_id, herkunft, stand, erstellt, bestaetigt_am) VALUES (100,'x',?,'gemeldet','bestaetigt',?,?)").run(IDS.Kai, nun, nun); melde("\n=== Die Kachel auf der Startseite ==="); -for (const [lagename, b, h] of [["Rechner", 1400, 900], ["Handy", 360, 780]]) { +for (const [lagename, b, h] of [["Rechner", 1400, 900], ["Breit", 1920, 1000], ["Handy", 360, 780]]) { const s = await seiteAls("g2", b, h); await s.seite.goto(`${BASIS}/workspace/start.html`, { waitUntil: "domcontentloaded" }); const da = await s.seite.waitForFunction(() => document.querySelector(".kachel__dogtag")?.getBoundingClientRect().height > 20, null, { timeout: 12000 }) @@ -131,9 +131,13 @@ for (const [lagename, b, h] of [["Rechner", 1400, 900], ["Handy", 360, 780]]) { if (!z) return null; const r = z.getBoundingClientRect(); const kachel = z.closest(".kachel").getBoundingClientRect(); - const stoert = [...z.closest(".kachel").querySelectorAll(".kachel__name, .kachel__unter, .kachel__titel, h2, h3, .kachel__leute")] - .filter((e) => { const q = e.getBoundingClientRect(); return q.width > 2 && !(r.right <= q.left || r.left >= q.right || r.bottom <= q.top || r.top >= q.bottom); }) - .map((e) => e.className); + /* GEMESSEN WIRD DER TEXT, NICHT SEIN KASTEN: Der Kasten des Namens + reicht über die ganze Kachel, die Schrift nur über ihre Zeichen. */ + const zeichen = (e) => { const rg = document.createRange(); rg.selectNodeContents(e); return rg.getBoundingClientRect(); }; + const stoert = [...z.closest(".kachel").querySelectorAll(".kachel__name, .kachel__unter, .kachel__titel, h2, h3")] + .map((e) => [e, zeichen(e)]).concat([...z.closest(".kachel").querySelectorAll(".kachel__leute")].map((e) => [e, e.getBoundingClientRect()])) + .filter(([, q]) => q.width > 2 && !(r.right <= q.left || r.left >= q.right || r.bottom <= q.top || r.top >= q.bottom)) + .map(([e]) => e.className); const ring = z.querySelector(".kdt-ring__fuell"); return { text: z.textContent, href: z.getAttribute("href"), drin: r.left >= kachel.left && r.right <= kachel.right && r.top >= kachel.top && r.bottom <= kachel.bottom, stoert, h: Math.round(r.height), w: Math.round(r.width), ring: !!ring && getComputedStyle(ring).strokeDashoffset === "0px", @@ -141,6 +145,15 @@ for (const [lagename, b, h] of [["Rechner", 1400, 900], ["Handy", 360, 780]]) { }); ok(da && !!m && /DogTag liegt bereit/.test(m.text) && /Jetzt heulen · 25 Nächte halten/.test(m.text) && m.href === "dogtags.html", `${lagename}: „${m?.text}“ in der Reaction-Kachel, führt zur Seite`); ok(!!m && m.drin && m.stoert.length === 0, `${lagename}: ganz in der Kachel, über keinem Text (${m?.stoert.join(",") || "frei"})`); + if (lagename === "Breit") { + const haengt = await s.seite.evaluate(() => { + const z = document.querySelector(".kachel__dogtag"); + const k = z.closest(".kachel").getBoundingClientRect(); + const kette = z.querySelector(".kdt-kette").getBoundingClientRect(); + return { abKante: Math.round(kette.top - k.top), rechts: Math.round(k.right - z.getBoundingClientRect().right), kachelH: Math.round(k.height) }; + }); + ok(haengt.abKante <= 2 && haengt.kachelH < 200, `Breit: der DogTag hängt an der oberen Kachelkante (Kette ab ${haengt.abKante} px, Kachel ${haengt.kachelH} hoch)`); + } ok(!!m && m.h >= 56 && m.marke && m.ring && m.titel === "Dein DogTag liegt bereit", `${lagename}: die Marke zum Anfassen — ${m?.w}×${m?.h} Punkte, Marke im vollen Ring, „${m?.titel}“`); await s.seite.waitForTimeout(3200); diff --git a/workspace/anleitung.html b/workspace/anleitung.html index 9548e031..e0a3c719 100644 --- a/workspace/anleitung.html +++ b/workspace/anleitung.html @@ -7,17 +7,17 @@ - - - - - + + + + + - - + +
@@ -289,16 +289,16 @@ Und anleitung.js braucht es doppelt: Symbol, Farbe, Name und Adresse jeder Karte kommen von dort, nicht vom Server. --> - + - - - - - - + + + + + +