Files
testdrive-jsui/examples/README.md
tegwick b84770e2d3 feat: add standalone JavaScript proof of concept
Created examples/standalone.html demonstrating testdrive-jsui as a pure
JavaScript library that works without any backend.

Features:
- Opens directly in browser (file:// works)
- Markdown rendering using marked.js from CDN
- Save/load content to browser localStorage
- Download markdown files
- No Python/Ruby/Java required

Validates JavaScript-first architecture:
- All rendering happens in browser
- Backend adapters are truly optional
- Zero coupling to any specific backend

Added examples/README.md:
- Usage instructions (just open in browser!)
- Architecture validation notes
- Next steps for full implementation

This proves the concept that testdrive-jsui can be a standalone
JavaScript library with language adapters being optional integration
helpers, not core functionality providers.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-16 12:06:50 +01:00

115 lines
2.7 KiB
Markdown

# TestDrive-JSUI Examples
This directory contains examples demonstrating TestDrive-JSUI as a standalone JavaScript library.
---
## 📁 Examples
### `standalone.html` - Pure JavaScript Demo
**Purpose**: Proves TestDrive-JSUI can work as a pure JavaScript library with no backend.
**Features**:
- ✅ Runs directly in browser (no server needed)
- ✅ Markdown rendering using marked.js
- ✅ Save/load to browser localStorage
- ✅ Download markdown files
- ✅ Zero dependencies on Python/Ruby/Java
**How to Use**:
```bash
# Option 1: Open directly in browser
open examples/standalone.html
# Option 2: From file system (works!)
# Just double-click the file
# Option 3: Serve with any static server
python3 -m http.server 8000
# Then visit: http://localhost:8000/examples/standalone.html
```
**What It Demonstrates**:
- JavaScript can handle all rendering
- No backend is required for core functionality
- Language adapters (Python/Ruby/Java) are truly optional
---
## 🎯 Architecture Validation
This standalone example validates the JavaScript-first architecture:
### ✅ What Works Without Backend
- Markdown parsing (marked.js)
- HTML rendering
- UI display
- Content management
- Save/load (localStorage)
- File download
### ⏸️ What's Still TODO (Full Implementation)
- Interactive editing UI
- Section-based editing
- Control panels (edit, debug, status)
- Keyboard shortcuts
- Themes
- Plugin system
### 🔧 What Backend Adapters Provide (Optional)
- Asset serving at scale
- Server-side storage
- User authentication
- Multi-user collaboration
- Testing infrastructure
---
## 🚀 Next Steps
### 1. Validate Proof of Concept
```bash
# Open standalone.html
# Verify markdown renders correctly
# Try save/load/download buttons
```
### 2. Full JavaScript Library
After validating the concept:
- Create `js/testdrive-jsui.js` main class
- Add interactive editing
- Implement control panels
- Full section management
### 3. Refactor Python Adapter
Once JavaScript is complete:
- Simplify Python to thin adapter
- Remove HTML generation
- Keep only asset serving and testing
---
## 📝 Notes
**Performance**: Loading from CDN (marked.js) means internet connection required. For fully offline use, download marked.js locally.
**Browser Support**: Works in all modern browsers (Chrome, Firefox, Safari, Edge). Requires ES6 support.
**File Size**: The standalone example loads individual JS files. Production version would use bundled `testdrive-jsui.min.js` (~50KB).
---
## 🤝 Contributing Examples
Want to add an example? Please ensure it:
1. Works standalone (no complex build required)
2. Demonstrates a specific use case
3. Includes inline documentation
4. Works by just opening in browser
---
**Status**: Proof of Concept
**Last Updated**: 2025-12-16