# test_ui_consistency.py """ Tests for UI consistency components across all verification modes. Validates that standardized components provide consistent styling, formatting, and behavior across all interfaces. Requirements: 12.1, 12.2, 12.3, 12.4, 12.5 """ import pytest from datetime import datetime from typing import Dict, Any from src.interface.ui_consistency_components import ( StandardizedComponents, ClassificationDisplay, ProgressDisplay, ErrorDisplay, SessionDisplay, HelpDisplay, UITheme, format_timestamp, format_file_size, truncate_text, format_duration ) class TestStandardizedComponents: """Test standardized UI component creation.""" def test_create_primary_button(self): """Test primary button creation with consistent styling.""" button = StandardizedComponents.create_primary_button("Test Button", "đŸ”Ĩ", "lg") assert button.value == "đŸ”Ĩ Test Button" assert button.variant == "primary" assert button.size == "lg" def test_create_secondary_button(self): """Test secondary button creation with consistent styling.""" button = StandardizedComponents.create_secondary_button("Test Button", "âš™ī¸", "sm") assert button.value == "âš™ī¸ Test Button" assert button.variant == "secondary" assert button.size == "sm" def test_create_stop_button(self): """Test stop button creation with consistent styling.""" button = StandardizedComponents.create_stop_button("Stop", "✋") assert button.value == "✋ Stop" assert button.variant == "stop" def test_create_navigation_button(self): """Test navigation button creation with consistent styling.""" button = StandardizedComponents.create_navigation_button("Back") assert button.value == "← Back" assert button.size == "sm" assert button.variant == "secondary" def test_create_export_button(self): """Test export button creation for different formats.""" csv_button = StandardizedComponents.create_export_button("csv") json_button = StandardizedComponents.create_export_button("json") xlsx_button = StandardizedComponents.create_export_button("xlsx") assert csv_button.value == "📄 Export CSV" assert json_button.value == "📋 Export JSON" assert xlsx_button.value == "📊 Export XLSX" # All should be secondary buttons with small size for button in [csv_button, json_button, xlsx_button]: assert button.variant == "secondary" assert button.size == "sm" class TestClassificationDisplay: """Test classification display formatting consistency.""" def test_format_classification_badge(self): """Test classification badge formatting.""" green_badge = ClassificationDisplay.format_classification_badge("green") yellow_badge = ClassificationDisplay.format_classification_badge("yellow") red_badge = ClassificationDisplay.format_classification_badge("red") unknown_badge = ClassificationDisplay.format_classification_badge("unknown") assert "đŸŸĸ" in green_badge and "GREEN" in green_badge assert "🟡" in yellow_badge and "YELLOW" in yellow_badge assert "🔴" in red_badge and "RED" in red_badge assert "❓" in unknown_badge and "UNKNOWN" in unknown_badge # Test case insensitivity assert ClassificationDisplay.format_classification_badge("GREEN") == green_badge assert ClassificationDisplay.format_classification_badge("Red") == red_badge def test_format_classification_html_badge(self): """Test HTML classification badge formatting.""" html_badge = ClassificationDisplay.format_classification_html_badge("green") assert "