generated from coulomb/repo-seed
Complete integration of refactored testdrive-jsui capability: ## Refactored Architecture - js/ - All JavaScript source (controls, components, core) - static/ - CSS, images, templates - src/testdrive_jsui/ - Python package - tests/ - Python tests ## Plugin Self-Declaration - get_plugin_source_dir() - plugin declares own location - get_asset_paths() - organized asset paths - No hardcoded discovery logic ## Merged Content - Baseline UI scaffold (tutorials, LICENSE, INTRODUCTION.md) - Refactored capability implementation - Comprehensive documentation Ready for standalone use or integration with markitect. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
86 lines
2.9 KiB
JavaScript
86 lines
2.9 KiB
JavaScript
/**
|
|
* Component Integration Tests (Jest Version)
|
|
*
|
|
* Tests that extracted components work together properly.
|
|
* Verifies the complete workflow: Section Creation → Rendering → Editing → Saving
|
|
*/
|
|
|
|
describe('Component Integration Tests', () => {
|
|
let SectionManager, Section, DOMRenderer, FloatingMenu, EditState;
|
|
let sectionManager, domRenderer, container;
|
|
|
|
beforeAll(() => {
|
|
// Load extracted components
|
|
const sectionModule = require('../core/section-manager.js');
|
|
const domModule = require('../components/dom-renderer.js');
|
|
|
|
SectionManager = sectionModule.SectionManager;
|
|
Section = sectionModule.Section;
|
|
DOMRenderer = domModule.DOMRenderer;
|
|
FloatingMenu = domModule.FloatingMenu;
|
|
EditState = sectionModule.EditState;
|
|
});
|
|
|
|
beforeEach(() => {
|
|
// Setup fresh container and components for each test
|
|
container = document.createElement('div');
|
|
container.innerHTML = '<div id="markdown-content"></div>';
|
|
document.body.appendChild(container);
|
|
|
|
sectionManager = new SectionManager();
|
|
domRenderer = new DOMRenderer(sectionManager, container);
|
|
});
|
|
|
|
afterEach(() => {
|
|
// Cleanup
|
|
if (container && container.parentNode) {
|
|
container.parentNode.removeChild(container);
|
|
}
|
|
});
|
|
|
|
test('should load all extracted components', () => {
|
|
expect(SectionManager).toBeTruthy();
|
|
expect(Section).toBeTruthy();
|
|
expect(DOMRenderer).toBeTruthy();
|
|
expect(FloatingMenu).toBeTruthy();
|
|
expect(EditState).toBeTruthy();
|
|
});
|
|
|
|
test('should support complete section creation workflow', () => {
|
|
// Test basic functionality without complex DOM manipulation
|
|
expect(sectionManager).toBeInstanceOf(SectionManager);
|
|
expect(domRenderer).toBeInstanceOf(DOMRenderer);
|
|
|
|
// Test section creation from markdown
|
|
const testMarkdown = `# Test Header
|
|
|
|
This is test content.
|
|
|
|
`;
|
|
|
|
// Create sections from markdown (the right method)
|
|
expect(() => {
|
|
const sections = sectionManager.createSectionsFromMarkdown(testMarkdown);
|
|
expect(sections.length).toBeGreaterThan(0);
|
|
}).not.toThrow();
|
|
});
|
|
|
|
test('should have core DOM rendering methods', () => {
|
|
expect(typeof domRenderer.renderAllSections).toBe('function');
|
|
expect(typeof domRenderer.showEditor).toBe('function');
|
|
expect(typeof domRenderer.findSectionElement).toBe('function');
|
|
});
|
|
|
|
test('should preserve editor showing functionality', () => {
|
|
const mockSection = {
|
|
id: 'test-section-001',
|
|
type: 'header',
|
|
content: 'Test content'
|
|
};
|
|
|
|
// Test basic editor functionality
|
|
expect(() => {
|
|
domRenderer.showEditor(mockSection.id);
|
|
}).not.toThrow();
|
|
});
|
|
}); |