fix: initialize file editor and remove broken individual file uploads

Changes:
- Add fileEditor.init() call in DOMContentLoaded to activate edit buttons
- Remove individual file upload inputs (projectInput, svgInput, cssInput, csvInput)
  that had CORS issues when loading project configurations
- Keep only the folder picker which works reliably
- Update UI to emphasize folder picker as the primary loading method
- Remove corresponding event handlers from engine.js
- Remove tests for individual file upload functionality

The folder picker loads all project files in one operation without CORS
issues, while individual file uploads failed when trying to load
referenced files (CSV, SVG, CSS) from the project.json.

All 56 tests passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 23:14:57 +01:00
parent 710794de88
commit a5811040e7
3 changed files with 23 additions and 218 deletions

View File

@@ -310,78 +310,7 @@ describe('Timeline Integration', () => {
})
})
describe('DOM Event Handling', () => {
it('should handle project file upload', async () => {
const config = createSampleProject()
const projectInput = document.createElement('input')
projectInput.id = 'projectInput'
document.body.appendChild(projectInput)
// Setup event handlers
window.setupEventHandlers()
// Mock file reading
const mockFile = new File([JSON.stringify(config)], 'project.json', { type: 'application/json' })
mockFile.text = vi.fn().mockResolvedValue(JSON.stringify(config))
// Mock the fetch calls that loadProjectConfigObject will make
mockFetch('/* test css */') // CSS
mockFetch(createSampleTemplate())
mockFetch(createSampleCSV())
mockPapaParse()
// Simulate file selection
Object.defineProperty(projectInput, 'files', {
value: [mockFile],
writable: false
})
// Trigger the event
const event = new Event('change')
projectInput.dispatchEvent(event)
// Wait for async operations
await new Promise(resolve => setTimeout(resolve, 0))
expect(document.getElementById('projectName').textContent).toBe('Test Project')
})
it('should handle CSV file upload', async () => {
const config = createSampleProject()
timelineEngine.config = config
timelineEngine.template = createSampleTemplate() // Need template for generation
const csvInput = document.createElement('input')
csvInput.id = 'csvInput'
document.body.appendChild(csvInput)
// Setup event handlers
window.setupEventHandlers()
const csvContent = createSampleCSV()
const mockFile = new File([csvContent], 'data.csv', { type: 'text/csv' })
mockFile.text = vi.fn().mockResolvedValue(csvContent)
global.Papa.parse.mockImplementation((text, options) => {
options.complete({
data: [{ ID: 'T-1', Title: 'Uploaded Task', Lane: 'Upload Lane', Due: '2025-01-15' }]
})
})
Object.defineProperty(csvInput, 'files', {
value: [mockFile],
writable: false
})
const event = new Event('change')
csvInput.dispatchEvent(event)
await new Promise(resolve => setTimeout(resolve, 0))
expect(timelineEngine.csvOverride).toBe(true)
expect(document.getElementById('viewer').innerHTML).toContain('Uploaded Task')
})
})
// DOM Event Handling tests removed - individual file uploads replaced with folder picker
describe('SVG Export', () => {
it('should hide IDs in external view for export', async () => {