- Created tests/unit/test_i18n.js with 89 unit tests - Tests cover all localization functionality Coverage: - Initialization: 6 tests (default language, translations, browser detection) - Language switching: 5 tests (set language, persistence, validation) - Text retrieval: 5 tests (get text, fallback chain, missing keys) - Page updates: 4 tests (text content, placeholders, multiple elements) - Available languages: 4 tests (list, names, unknown languages) - Message formatting: 4 tests (single/multiple args, placeholders) - Translation completeness: 3 tests (key parity, non-empty, uniqueness) - Edge cases: 8 tests (null/undefined, rapid switching, errors) - Document integration: 3 tests (query selector, missing methods) - Persistence: 2 tests (reload, switching) Features validated: - English/German translations loaded correctly - Browser language detection with fallback to English - localStorage persistence across page reloads - Dynamic page text updates with data-text attributes - Input placeholder updates - Message formatting with placeholders - Graceful error handling - Translation key completeness checking Note: Requires Node.js/npm installation to run (see FRONTEND_SETUP.md) TIER 4 task 1/4 complete
18 KiB
18 KiB