107 lines
4.1 KiB
Python
107 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Code verification for the new kvist layout structure
|
|
Verifies the actual code changes without needing Selenium
|
|
"""
|
|
|
|
import re
|
|
|
|
def verify_kvist_layout_code():
|
|
"""Verify the kvist layout code structure"""
|
|
|
|
print("🔍 Verifying kvist layout code structure...")
|
|
print("="*60)
|
|
|
|
file_path = '/mnt/HC_Volume_103713257/tilbudgivern/frontend/src/components/EnhancedGeometry.js'
|
|
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
tests_passed = 0
|
|
total_tests = 6
|
|
|
|
# Test 1: Check for maxWidth 800px container
|
|
print("\n1️⃣ Checking for centered container with maxWidth 800px...")
|
|
if "maxWidth: '800px'" in content and "margin: '20px auto" in content:
|
|
print("✅ Found centered container: maxWidth: '800px', margin: '20px auto'")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Centered container not found")
|
|
|
|
# Test 2: Check for yellow info box (#fffacd)
|
|
print("\n2️⃣ Checking for yellow info box (Kvist detaljer)...")
|
|
if "background: '#fffacd'" in content and "border: '2px solid #f0e68c'" in content:
|
|
print("✅ Found yellow info box with correct colors")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Yellow info box colors not found")
|
|
|
|
# Test 3: Check for "Kvist detaljer (påkrævet)" heading
|
|
print("\n3️⃣ Checking for 'Kvist detaljer (påkrævet)' heading...")
|
|
if "Kvist detaljer (påkrævet)" in content:
|
|
print("✅ Found heading: 'Kvist detaljer (påkrævet)'")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Heading not found")
|
|
|
|
# Test 4: Check for toggle button functionality
|
|
print("\n4️⃣ Checking for toggle button...")
|
|
if "toggleKvistComponents" in content and "showKvistComponents" in content:
|
|
print("✅ Found toggle functionality: toggleKvistComponents and showKvistComponents")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Toggle functionality not found")
|
|
|
|
# Test 5: Check for blue measurements box
|
|
print("\n5️⃣ Checking for blue measurements box...")
|
|
if "background: '#f0f8ff'" in content and "border: '2px solid #4682b4'" in content:
|
|
print("✅ Found blue measurements box with correct colors")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Blue measurements box colors not found")
|
|
|
|
# Test 6: Check for component lists (Spær & Bærende, Vinduer & Beklædning)
|
|
print("\n6️⃣ Checking for component lists...")
|
|
if "🪚 Spær & Bærende:" in content and "🪟 Vinduer & Beklædning:" in content:
|
|
print("✅ Found component lists: Spær & Bærende and Vinduer & Beklædning")
|
|
tests_passed += 1
|
|
else:
|
|
print("❌ Component lists not found")
|
|
|
|
# Bonus: Check structure order
|
|
print("\n🔍 Verifying structure order...")
|
|
yellow_box_pos = content.find("background: '#fffacd'")
|
|
blue_box_pos = content.find("background: '#f0f8ff'")
|
|
|
|
if yellow_box_pos > 0 and blue_box_pos > yellow_box_pos:
|
|
print("✅ Structure order correct: Yellow info box appears before blue measurements box")
|
|
else:
|
|
print("⚠️ Structure order might be different")
|
|
|
|
# Summary
|
|
print("\n" + "="*60)
|
|
print("📊 CODE VERIFICATION SUMMARY")
|
|
print("="*60)
|
|
print(f"✅ Tests passed: {tests_passed}/{total_tests}")
|
|
|
|
if tests_passed == total_tests:
|
|
print("\n🎉 ALL TESTS PASSED! Code structure is correct!")
|
|
print("\n✨ Layout features verified:")
|
|
print(" - Centered container (max-width: 800px)")
|
|
print(" - Yellow collapsible info box at top")
|
|
print(" - Toggle button for showing/hiding components")
|
|
print(" - Blue measurements box below")
|
|
print(" - Component lists properly structured")
|
|
return True
|
|
elif tests_passed >= 4:
|
|
print("\n⚠️ PARTIAL SUCCESS - Most features verified")
|
|
return True
|
|
else:
|
|
print("\n❌ TESTS FAILED - Some features missing")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
import sys
|
|
success = verify_kvist_layout_code()
|
|
sys.exit(0 if success else 1)
|