chore: delete redundant test archive - enforce zero redundancy policy

Deleted entire tests/archive/ directory (17+ test files, 188KB)
- All archive tests were 100% redundant with active tests
- Archive contained: toggles, zoom, hyperscript, keyboard, integration, misc tests
- Active tests (0-11) provide superior coverage

Updated TEST-SUMMARY.md:
- Removed archive references
- Added "Test Philosophy" section
- Updated test count to reflect deletion
- Emphasized zero redundancy policy

Coverage mapping (archive → active):
- toggles/* → 1-toggles.test.mjs 
- zoom/* → 0-zoom.test.mjs + 10-zoom-persistence + 11-zoom-ui-exclusion 
- hyperscript/* → 3-hyperscript.test.mjs + 9-hyperscript-def-limit 
- keyboard/* → 2-keyboard-shortcuts.test.mjs 
- integration/* → All active tests combined 
- misc/* → Various active tests 

Philosophy: If a test doesn't provide unique value, it doesn't exist.
This commit is contained in:
juanatsap
2025-11-17 18:04:07 +00:00
parent 52e97f1411
commit 4b01134584
24 changed files with 167 additions and 4428 deletions
+103 -2
View File
@@ -45,9 +45,14 @@ const showLogos = ...
**Historical Context:**
- Hyperscript 0.9.12 had a hard 3 def limit
- Latest hyperscript version removed this limitation
- Hyperscript 0.9.14+ removed this limitation
- Functions were moved to JavaScript as workaround
- Now migrating back to hyperscript for cleaner architecture
- **NOW MIGRATED BACK** to hyperscript with JavaScript wrappers (2025-11-17)
**Current Architecture (2025-11-17):**
- Core logic in hyperscript (`static/hyperscript/*.hs`)
- JavaScript wrappers for `call` command compatibility (`static/js/cv-functions.js`)
- Pattern: `window.fn()``_hyperscript.evaluate('hyperscriptFn()')`
**Current Best Practice:** Organize hyperscript functions by category in separate files
@@ -517,3 +522,99 @@ document.addEventListener('keydown', (e) => {
**Project Status:** Production - Migrating to hyperscript architecture
**Test Coverage:** 10 systematic tests, 100% core features + def limit verification
**Critical Memory Files:** This file + `~/.claude/cv-icons-migration.md`
---
### 3. Hyperscript-JavaScript Interoperability (CRITICAL - 2025-11-17)
**Rule: Hyperscript `call` in attributes requires global JavaScript scope**
```html
<!-- ❌ DOESN'T WORK - Hyperscript def not in window -->
<button _="on click call hyperscriptFunction()">Click</button>
<!-- ✅ WORKS - JavaScript wrapper exposes to window -->
window.functionName = () => _hyperscript.evaluate('hyperscriptFunction()');
```
**Why this matters:**
- Hyperscript docs say "global hyperscript functions can be called from JavaScript" ✅ TRUE
- BUT the reverse (`call` in `_=""` attributes) requires functions in `window` object
- Hyperscript `def` functions are NOT automatically exposed to window
- Templates use `_="on mouseenter call syncPdfHover(true)"` syntax
**Solution - Wrapper Pattern:**
```javascript
// static/js/cv-functions.js
function syncPdfHover(show) {
if (typeof _hyperscript !== 'undefined') {
_hyperscript.evaluate('syncPdfHover(' + show + ')');
}
}
window.syncPdfHover = syncPdfHover;
```
**Files:**
- Implementation: `static/hyperscript/*.hs` (toggles._hs, hover-sync._hs)
- Wrappers: `static/js/cv-functions.js`
- Test: `tests/mjs/8-hover-sync.test.mjs`
**Bug History:** Hover sync broke when JavaScript functions were deleted during hyperscript migration. Restored as thin wrappers (commit 491aa66).
---
### 4. Zoom Architecture (CRITICAL - 2025-11-17)
**Rule: Only CV content inside #zoom-wrapper, NOT UI chrome**
```html
<!-- ✅ CORRECT Structure -->
<div id="zoom-wrapper">
<div class="cv-container">CV Content</div>
</div>
{{template "page-footer" .}} <!-- OUTSIDE zoom-wrapper -->
```
**What gets zoomed (INSIDE #zoom-wrapper):**
- ✅ CV paper (.cv-container)
- ✅ CV content (.cv-paper)
**What does NOT get zoomed (OUTSIDE #zoom-wrapper):**
- ✅ Footer
- ✅ Action bar
- ✅ Hamburger menu
- ✅ Fixed buttons (PDF, print, zoom toggle, etc.)
**Zoom Range:** 25% - 300% (updated from 175% on 2025-11-17)
**localStorage Keys:**
- `cv-zoom` - Current zoom level (25-300)
- `cv-zoom-visible` - Whether zoom control is shown (true/false)
- `cv-zoom-position` - Draggable position of zoom control
**Critical Bug Fixed (commit 52e97f1):**
- Footer was INSIDE zoom-wrapper → got zoomed with content
- Moved footer OUTSIDE zoom-wrapper → stays normal size
- Test: `tests/mjs/11-zoom-ui-exclusion.test.mjs`
**Critical Bug Fixed (commit 35a836a):**
- Zoom persistence broken - set wrong element's value
- zoom-control.html:10 was `set my value` (div) instead of `set #zoom-slider's value`
- Test: `tests/mjs/10-zoom-persistence.test.mjs`
---
### 5. Test Maintenance (REQUIRED - 2025-11-17)
**Rule: Update tests/TEST-SUMMARY.md every time you add a test**
When adding new test files:
1. Create test file: `tests/mjs/{N}-{feature}.test.mjs`
2. Update `tests/TEST-SUMMARY.md` with test description
3. Update test count at bottom of TEST-SUMMARY.md
4. Add to New Tests section with date
**Current Test Count:** 12 active (0-11), 60+ archived
**Master test runner:** `tests/run-all.mjs` (auto-discovers numbered tests)