Spaces:
Sleeping
Sleeping
File size: 2,218 Bytes
24214fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
#!/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 = """
<system_role>
You are a helpful assistant.
</system_role>
<output_format>
Respond in JSON format.
</output_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() |