# Phase 6 Testing Checklist

**Status:** Ready for testing
**Date:** 2025-01-12
**JavaScript Reduction:** 954 → 239 lines (-74.9%)

---

## 🎯 What Changed in Phase 6

### 1. Scroll Behavior (59 lines → Hyperscript)
- Header hide/show on scroll
- Back-to-top button visibility
- At-bottom positioning
- **Now:** Clean 2-line implementation in `<body>`

### 2. Print Function (44 lines → Hyperscript)
- Print-friendly theme/layout
- Zoom reset for printing
- State restoration after print
- **Bug Fixed:** Zoom restoration now works!
- **Now:** Single line `call printFriendly()`

### 3. Hyperscript Organization
- Extracted 115 lines from HTML templates
- Created `/static/hyperscript/functions._hs` (110 lines)
- Clean function calls instead of inline code

---

## ✅ Testing Checklist

### Scroll Behavior Testing

**Header Hide/Show:**
- [ ] Scroll down >100px → Header hides
- [ ] Scroll up → Header shows
- [ ] At top (<100px) → Header always visible
- [ ] Works smoothly without flickering

**Back-to-Top Button:**
- [ ] Hidden when at top
- [ ] Appears after scrolling down 300px
- [ ] Click button → Smooth scroll to top
- [ ] Native anchor link works

**At-Bottom Positioning:**
- [ ] Scroll to bottom (<50px from end)
- [ ] Back-to-top button moves up (`.at-bottom` class)
- [ ] Info button moves up (`.at-bottom` class)
- [ ] Smooth transition

**Menu Coordination:**
- [ ] Open hamburger menu
- [ ] Scroll down → Menu hides with header
- [ ] Scroll up → Menu shows with header

---

### Print Function Testing

**Desktop Print Button:**
- [ ] Click "Print Friendly" in action bar
- [ ] Theme changes to clean (no sidebars)
- [ ] Content changes to short version
- [ ] Zoom resets to 100% in print preview
- [ ] Cancel print dialog
- [ ] Original theme restores
- [ ] Original length restores
- [ ] **CRITICAL:** Original zoom restores (was broken before!)

**Mobile Print Button:**
- [ ] Open hamburger menu
- [ ] Click "Print Friendly"
- [ ] Same behavior as desktop
- [ ] All state restores correctly

**Print with Different States:**
- [ ] Print with clean theme already active → Stays clean
- [ ] Print with long version → Restores to long
- [ ] Print with 150% zoom → Restores to 150%
- [ ] Print with 75% zoom → Restores to 75%

---

### Hyperscript Functions Testing

**Functions Load Correctly:**
- [ ] Open browser console
- [ ] No errors about undefined functions
- [ ] Check `/static/hyperscript/functions._hs` loads
- [ ] Verify loading order (functions before hyperscript lib)

**Function Calls Work:**
- [ ] `printFriendly()` called successfully
- [ ] `initScrollBehavior()` initializes state
- [ ] `handleScroll()` processes scroll events
- [ ] No JavaScript errors in console

---

### Cross-Browser Testing

**Chrome/Edge:**
- [ ] All scroll behavior works
- [ ] Print function works
- [ ] No console errors

**Firefox:**
- [ ] All scroll behavior works
- [ ] Print function works
- [ ] No console errors

**Safari:**
- [ ] All scroll behavior works
- [ ] Print function works
- [ ] No console errors

---

### Mobile Testing

**Responsive Behavior:**
- [ ] Resize to mobile width (<768px)
- [ ] Scroll behavior works on mobile
- [ ] Print button in hamburger menu works
- [ ] No errors on mobile viewport

---

## 🐛 Known Issues to Watch For

### Potential Issues:

1. **Functions not loading:**
   - Check loading order in `<head>`
   - Functions._hs must load BEFORE hyperscript.org

2. **Print zoom not restoring:**
   - If zoom stays at 100%, check zoom slider exists
   - Verify `send input to #zoom-slider` works

3. **Scroll state not persisting:**
   - Check `:lastScroll` variable scope
   - Verify `init` call happens on page load

---

## 📊 Expected Results

### Performance:
- Smooth 60fps scrolling
- No jank or flickering
- Fast print dialog appearance
- Instant state restoration

### Functionality:
- All 100% working (no regressions)
- Print bug fixed (zoom restores)
- Cleaner HTML templates
- Organized code structure

### File Sizes:
- `main.js`: ~239 lines (was 954)
- `functions._hs`: 110 lines (new)
- Total JS: ~15KB (was ~35KB)

---

## 🚨 If Something Breaks

### Debug Steps:

1. **Open browser console** (F12)
2. **Check for errors:**
   - Red error messages?
   - Undefined function errors?
   - Loading errors?

3. **Verify file loads:**
   - Network tab → Check `functions._hs` loads
   - Status 200 OK?

4. **Check loading order:**
   ```html
   <!-- Should be in this order: -->
   <script type="text/hyperscript" src="/static/hyperscript/functions._hs"></script>
   <script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
   ```

5. **Test JavaScript console:**
   ```javascript
   // Try calling functions manually:
   printFriendly()
   initScrollBehavior()
   handleScroll()
   ```

---

## ✨ Success Criteria

**Phase 6 is successful if:**
- ✅ All scroll behavior works smoothly
- ✅ Print function works + restores zoom
- ✅ No JavaScript errors in console
- ✅ HTML templates are clean (no long inline code)
- ✅ Functions are reusable and organized
- ✅ No regressions from Phase 5

---

## 📝 Notes for Tomorrow

**What to look for:**
1. Smooth scroll behavior (most important - used constantly)
2. Print zoom restoration (was broken, now fixed)
3. Clean HTML templates (visual inspection)
4. No console errors

**If all tests pass:**
- Phase 6 is complete! 🎉
- 74.9% JavaScript reduction achieved
- Ready to show off modern techniques

**If issues found:**
- Note specific issue
- Check console for errors
- Provide error messages/behavior description

---

**Good luck with testing tomorrow! 🚀**

*Remember: Start your CV server first, then test in browser at http://localhost:1999*
