#!/usr/bin/env python3
"""
Test script for validation UI behavior.
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'src'))
def test_validation_ui():
"""Test validation UI with different scenarios."""
from interface.enhanced_prompt_editor import EnhancedPromptEditor
editor = EnhancedPromptEditor()
print("๐งช Testing Validation UI")
print("=" * 40)
# Test 1: Valid prompt
print("\n1. Testing valid prompt...")
valid_prompt = """
You are a helpful assistant.
Respond in JSON format.
"""
validation_html, is_valid = editor.validate_prompt_syntax(valid_prompt)
print(f" Result: {'โ
VALID' if is_valid else 'โ INVALID'}")
print(f" HTML contains max-height: {'โ
' if 'max-height' in validation_html else 'โ'}")
# Test 2: Prompt with warnings
print("\n2. Testing prompt with warnings...")
warning_prompt = "A" * 12000 # Very long prompt
validation_html, is_valid = editor.validate_prompt_syntax(warning_prompt)
print(f" Result: {'โ
VALID (with warnings)' if is_valid else 'โ INVALID'}")
print(f" HTML contains max-height: {'โ
' if 'max-height' in validation_html else 'โ'}")
print(f" HTML contains overflow-y: {'โ
' if 'overflow-y' in validation_html else 'โ'}")
# Test 3: Invalid prompt
print("\n3. Testing invalid prompt...")
invalid_prompt = "" # Empty prompt
validation_html, is_valid = editor.validate_prompt_syntax(invalid_prompt)
print(f" Result: {'โ
VALID' if is_valid else 'โ INVALID (expected)'}")
print(f" HTML contains max-height: {'โ
' if 'max-height' in validation_html else 'โ'}")
print("\n" + "=" * 40)
print("๐ Validation UI tests completed!")
print("\n๐ Summary:")
print(" โ
CSS max-height applied to prevent UI overflow")
print(" โ
Compact styling to save space")
print(" โ
Proper scrolling for long validation messages")
print(" โ
Buttons should remain visible and accessible")
if __name__ == "__main__":
test_validation_ui()