Files
cv-site/tests/mjs
juanatsap d2330f5d48 refactor: migrate toggle and hover sync functions from JavaScript to Hyperscript
BREAKING: Removed JavaScript toggle functions in favor of organized Hyperscript architecture

Changes:
- Created organized Hyperscript file structure (no def limit with latest version):
  • static/hyperscript/utils._hs (utility functions)
  • static/hyperscript/toggles._hs (CV length, icons, theme toggles)
  • static/hyperscript/hover-sync._hs (PDF/Print hover sync + zoom highlight)

- Removed functions._hs (renamed to utils._hs for better organization)

- Emptied static/js/cv-functions.js (kept file with migration notice)
  • toggleCVLength, toggleIcons, toggleTheme → toggles._hs
  • syncPdfHover, syncPrintHover, highlightZoomControl → hover-sync._hs

- Updated templates/index.html to load all 3 new hyperscript files

- Updated tests/mjs/1-toggles.test.mjs for responsive design
  • Added viewport detection for desktop vs mobile toggles
  • Tests now adapt to screen size

Rationale:
- Test 9 confirmed NO def limit with latest hyperscript (tested up to 5 defs)
- Better separation of concerns with category-based file organization
- Aligns with server-side hypermedia pattern (HTMX + Hyperscript)
- Eliminates workaround JavaScript duplication
- 9 total def statements across 3 files (proving no limit)

Verified:
 All hyperscript files load successfully (HTTP 200)
 Hyperscript library loads without errors
 Functions work correctly in browser
 No console errors
 Test 9 (def limit) passes with 5 def statements

Related: Test 9 verification (tests/mjs/9-hyperscript-def-limit.test.mjs)
2025-11-17 16:28:52 +00:00
..

CV Project Test Suite

Organized test files for the CV application. All tests use Playwright for browser automation.

Test Files

0-zoom.test.mjs

Purpose: Test zoom control functionality

  • Verifies zoom control elements exist
  • Tests visibility toggle
  • Validates zoom slider interaction
  • Checks real-time zoom updates

Run: bun tests/mjs/0-zoom.test.mjs

1-toggles.test.mjs

Purpose: Comprehensive toggle testing with real-time visual verification

  • Tests all 3 toggles (Length, Icons, Theme)
  • Validates action bar toggles
  • Tests hamburger menu toggles
  • Verifies synchronization between action bar and menu
  • Checks localStorage persistence
  • Critical: Validates that toggles update DOM immediately (no refresh needed)
  • Takes screenshots for visual comparison

Run: bun tests/mjs/1-toggles.test.mjs

Running All Tests

# Run individual tests
bun tests/mjs/0-zoom.test.mjs
bun tests/mjs/1-toggles.test.mjs

# Run all tests sequentially
for test in tests/mjs/*.test.mjs; do
  echo "Running $test..."
  bun "$test"
  echo ""
done

Test Requirements

  • Server must be running on http://localhost:1999
  • Browser window will stay open after tests for manual verification
  • Press Ctrl+C to exit test

Test Output

All tests provide:

  • Clear pass/fail indicators
  • 📊 Summary of results
  • Detailed error messages
  • 🎉 Success confirmation

Screenshots

Toggle tests save screenshots to tests/screenshots/:

  • before-icon-toggle.png - Before clicking icon toggle
  • after-icon-toggle.png - After clicking icon toggle

Use these to visually verify rendering changes.