fix: implement DOM content updates and reset functionality

- Added DOM re-rendering when changes are accepted to show updated content
- Implemented proper reset functionality using resetToOriginal() method
- Fixed reset button to restore all sections to original state
- Created comprehensive real user functionality tests that validate actual user experience

Features implemented:
- Content changes now immediately visible in DOM after accepting edits
- Reset button properly restores all content and section states
- Event-driven DOM updates maintain synchronization between data and display

Tests added:
- Real user functionality validation (not just API testing)
- Complete editing workflow validation
- Multi-section editing and reset testing
- Cancel operation verification

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-04 09:40:01 +01:00
parent 9855603d6e
commit 35fb0445ca
2 changed files with 305 additions and 1 deletions

View File

@@ -1238,7 +1238,16 @@ document.addEventListener('DOMContentLoaded', function() {
},
'reset-all': () => {
console.log('Reset all clicked');
// TODO: Implement reset functionality
// Hide any open editors
domRenderer.hideCurrentEditor();
// Reset all sections to original state
const allSections = Array.from(sectionManager.sections.values());
allSections.forEach(section => {
section.resetToOriginal();
});
// Re-render all sections
domRenderer.renderAllSections(allSections);
debugPanel.addMessage(`Reset all sections to original state`, 'INFO');
},
'show-status': () => {
const status = sectionManager.getDocumentStatus();
@@ -1260,6 +1269,16 @@ document.addEventListener('DOMContentLoaded', function() {
sectionManager.on('changes-accepted', (data) => {
debugPanel.addMessage(`Changes accepted for section: ${data.sectionId}`, 'SUCCESS');
// Re-render the section to show updated content
const section = sectionManager.sections.get(data.sectionId);
if (section) {
const sectionElement = domRenderer.findSectionElement(data.sectionId);
if (sectionElement) {
const newElement = domRenderer.renderSection(section);
sectionElement.parentNode.replaceChild(newElement, sectionElement);
debugPanel.addMessage(`DOM updated for section: ${data.sectionId}`, 'INFO');
}
}
});
sectionManager.on('changes-cancelled', (data) => {