""" Unit Tests for School Frontend Module Tests for the refactored school frontend components: - school_styles.py (CSS styles) - school_templates.py (Page templates) """ import pytest import sys sys.path.insert(0, '..') from frontend.school_styles import get_school_base_styles from frontend.school_templates import ( render_school_sidebar, render_school_base_page, SCHOOL_NAV_ITEMS, SCHOOL_ICONS ) class TestSchoolStyles: """Test CSS styles""" def test_get_school_base_styles_returns_string(self): """Test that get_school_base_styles returns a string""" result = get_school_base_styles() assert isinstance(result, str) assert len(result) > 0 def test_css_contains_variables(self): """Test that CSS contains CSS variables""" css = get_school_base_styles() assert "--bp-primary:" in css assert "--bp-bg:" in css assert "--bp-surface:" in css def test_css_contains_layout_classes(self): """Test that CSS contains layout classes""" css = get_school_base_styles() assert ".app-container" in css assert ".sidebar" in css assert ".main-content" in css def test_css_contains_component_classes(self): """Test that CSS contains component classes""" css = get_school_base_styles() assert ".btn" in css assert ".card" in css assert ".table" in css class TestSchoolTemplates: """Test template rendering functions""" def test_school_nav_items_defined(self): """Test that navigation items are defined""" assert len(SCHOOL_NAV_ITEMS) > 0 assert any(item['id'] == 'dashboard' for item in SCHOOL_NAV_ITEMS) def test_school_icons_defined(self): """Test that icons are defined""" assert len(SCHOOL_ICONS) > 0 assert 'home' in SCHOOL_ICONS assert 'users' in SCHOOL_ICONS def test_render_school_sidebar_returns_string(self): """Test that render_school_sidebar returns a string""" result = render_school_sidebar() assert isinstance(result, str) def test_render_school_sidebar_contains_navigation(self): """Test that sidebar contains navigation items""" result = render_school_sidebar() assert "sidebar" in result assert "/school" in result assert "Dashboard" in result def test_render_school_sidebar_active_page(self): """Test active page highlighting""" result = render_school_sidebar("attendance") assert "active" in result assert "Anwesenheit" in result def test_render_school_sidebar_contains_all_nav_items(self): """Test that all navigation items are present""" result = render_school_sidebar() for item in SCHOOL_NAV_ITEMS: assert item['label'] in result, f"Missing nav item: {item['label']}" def test_render_school_base_page_returns_html(self): """Test that render_school_base_page returns HTML""" result = render_school_base_page("Test Title", "
Test Content
") assert isinstance(result, str) assert "" in result assert "