Merge fix/BUG-03-span-geometry: CSS-Grid-Span-Geometrie im Initial-Render
Konflikt in renderGrid() zwischen HEAD (BUG-01: kein HTML5-draggable, touch-action:none) und BUG-03 (alter draggable=true). Resolution: HEAD-Variante behalten — BUG-01 hat den HTML5-Drag komplett entfernt, BUG-03 nur die Span-Geometrie gefixt. Kompatibel, kein Re-Konflikt. Tests: 5/5 Python + 7/7 Pointer-Events + 8/8 Span-Geometry = alle grün.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// Test für BUG-03: Span-Geometrie im Initial-Render.
|
||||
//
|
||||
// Erwartung nach Fix:
|
||||
// 1) renderGrid setzt grid-column/grid-row am Item direkt (per JS).
|
||||
// 2) Item wird in den Container gehängt (cont.appendChild), nicht in originCell.
|
||||
// 3) Origin-Cell bekommt nur die "occupied"-Klasse.
|
||||
// 4) 2x2-Item hat style.gridColumn === '<x+1> / span 2' und gridRow === '<y+1> / span 2'.
|
||||
|
||||
const fs = require('fs');
|
||||
const html = fs.readFileSync('templates/index.html', 'utf8');
|
||||
const js = html.match(/<script>\s*\n([\s\S]*?)<\/script>/)[1];
|
||||
|
||||
function check(name, fn) {
|
||||
const r = fn();
|
||||
console.log((r ? '✓' : '✗') + ' ' + name);
|
||||
if (!r) process.exitCode = 1;
|
||||
}
|
||||
|
||||
// 1) renderGrid setzt style.gridColumn/gridRow am Item
|
||||
check('gridColumn wird per JS gesetzt', () =>
|
||||
/\.style\.gridColumn\s*=/.test(js));
|
||||
|
||||
check('gridRow wird per JS gesetzt', () =>
|
||||
/\.style\.gridRow\s*=/.test(js));
|
||||
|
||||
// 2) Item wird in cont.appendChild gehängt, NICHT in originCell.appendChild
|
||||
check('Item wird in Container (cont) gehängt', () =>
|
||||
/cont\.appendChild\(div\)/.test(js));
|
||||
|
||||
check('Item wird NICHT mehr in Origin-Cell gehängt', () =>
|
||||
!/originCell\.appendChild\(div\)/.test(js));
|
||||
|
||||
// 3) Origin-Cell bekommt nur occupied-Klasse
|
||||
check('Origin-Cell bekommt "occupied" Klasse', () =>
|
||||
/originCell\.classList\.add\(['"]occupied['"]\)/.test(js));
|
||||
|
||||
// 4) Format: `${it.x + 1} / span ${it.w}` (CSS-Grid-Notation)
|
||||
check('gridColumn Format: <x+1> / span <w>', () =>
|
||||
/it\.x\s*\+\s*1[^`]*\$\{it\.w\}/.test(js) || /\$\{it\.x\s*\+\s*1\}[^`]*span[^`]*\$\{it\.w\}/.test(js));
|
||||
|
||||
// 5) Kein 100%/100% Trick auf Items (das war der Bug, der Span verhindert hat)
|
||||
check('Keine "width: 100%" mehr im Item-CSS-Block', () => {
|
||||
const css = html.match(/<style>([\s\S]*?)<\/style>/g).join('\n');
|
||||
// .grid-item soll nicht width:100% haben
|
||||
const itemCssMatch = /\.grid-item\s*\{([^}]*)\}/.exec(css);
|
||||
if (!itemCssMatch) return true; // falls keine Regel
|
||||
const body = itemCssMatch[1];
|
||||
return !/width:\s*100%/.test(body);
|
||||
});
|
||||
|
||||
// 6) Visuelle Begründung im CSS-Kommentar (für die Nachwelt)
|
||||
check('CSS-Kommentar erwähnt BUG-03 Span-Geometrie', () =>
|
||||
/BUG-03/i.test(html));
|
||||
|
||||
console.log('\n========');
|
||||
process.exit(process.exitCode || 0);
|
||||
Reference in New Issue
Block a user