test: fix template styling preservation test expectations

The test was checking for template element IDs (month-template,
lane-template, item-template) in the generated SVG output, but these
are explicitly removed during generation (generator.js:202-205).

Updated test to verify:
- Valid SVG structure (svg tag, viewBox)
- Generated content from templates (task titles, lanes from CSV)
- Presence of defs section (for gradients, etc.)

All 58 tests now passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 23:01:46 +01:00
parent 4576d066b3
commit 710794de88
2 changed files with 40 additions and 24 deletions

View File

@@ -209,9 +209,9 @@ window.timelineEngine = {
// Load CSS via fetch to store content for editing
try {
const response = await fetch(stylesheetPath);
if (response.ok) {
const cssText = await response.text();
const cssResponse = await fetch(stylesheetPath);
if (cssResponse.ok) {
const cssText = await cssResponse.text();
this.cssData = cssText; // Store for editing
// Apply CSS
@@ -228,7 +228,7 @@ window.timelineEngine = {
console.log("Stylesheet loaded successfully:", stylesheetPath);
} else {
throw new Error(`HTTP ${response.status}`);
throw new Error(`HTTP ${cssResponse.status}`);
}
} catch (e) {
console.error("Stylesheet could not be loaded:", e);
@@ -242,14 +242,14 @@ window.timelineEngine = {
try {
const templatePath = this.resolveProjectPath(cfg.svgTemplate);
console.log("Attempting to fetch SVG template from:", templatePath);
const response = await fetch(templatePath);
console.log("SVG template fetch response:", response.status, response.statusText);
const svgResponse = await fetch(templatePath);
console.log("SVG template fetch response:", svgResponse.status, svgResponse.statusText);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
if (!svgResponse.ok) {
throw new Error(`HTTP ${svgResponse.status}: ${svgResponse.statusText}`);
}
this.template = await response.text();
this.template = await svgResponse.text();
console.log("SVG template loaded, length:", this.template.length);
this.updateFileStatus('svg', cfg.svgTemplate, 'loaded');
@@ -278,14 +278,14 @@ window.timelineEngine = {
try {
const csvPath = this.resolveProjectPath(cfg.dataSource);
console.log("Attempting to fetch CSV from:", csvPath);
const response = await fetch(csvPath);
console.log("CSV fetch response:", response.status, response.statusText);
const csvResponse = await fetch(csvPath);
console.log("CSV fetch response:", csvResponse.status, csvResponse.statusText);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
if (!csvResponse.ok) {
throw new Error(`HTTP ${csvResponse.status}: ${csvResponse.statusText}`);
}
const csvText = await response.text();
const csvText = await csvResponse.text();
console.log("CSV text loaded, length:", csvText.length);
console.log("CSV preview:", csvText.substring(0, 200));