fix: Fix all 68 frontend test failures
P1 Code Bugs: - SettingsPlugins.tsx: Array.isArray guard for plugins.map (9 tests) - HtmlBlock.tsx: javascript: URL sanitization in href attributes (1 test, security fix) P2 Test-Setup (QueryClientProvider): - Dashboard.test.tsx: Add QueryClientProvider + dashboard mock (11 tests) - CalendarPage.test.tsx: Add QueryClientProvider + savedFilters mock (8 tests) - SessionList.test.tsx: Add QueryClientProvider (6 tests) - MailPage.test.tsx: Add QueryClientProvider + savedFilters mock (8 tests fixed) - DmsPage.test.tsx: Add QueryClientProvider + DMS API mocks (2 tests fixed) - SettingsSystem.test.tsx: Add QueryClientProvider + sub-page mocks (1 test fixed) P2 Test-Setup (ChevronDown Mock): - Reports.test.tsx: Add ChevronDown to lucide-react mock (5 tests) P3 Text Fix: - UploadDropzone.test.tsx: Fix umlaut Auswaehlen -> Auswahlen (1 test) Pre-existing Test Fixes (18 tests): - MailPage.test.tsx: Remove 6 obsolete tests (compose-btn, shared-mailbox-selector, etc. — now plugin toolbar actions) - DmsPage.test.tsx: Adapt 3 tests to new testids, remove 3 obsolete tests (upload/folder/search now plugin toolbar actions) - SettingsSystem.test.tsx: Remove 4 obsolete tests (form fields moved to sub-pages) - PluginRouteRenderer.test.tsx: Adapt test to loading spinner behavior - ShareDialog.test.tsx: Fix button text i18n mismatch
This commit is contained in:
@@ -13,7 +13,13 @@ const HtmlBlock: React.FC<HtmlBlockProps> = ({ block }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sanitized = DOMPurify.sanitize(rawHtml);
|
||||
// Replace javascript: URLs in href attributes before sanitizing
|
||||
const safeHtml = rawHtml.replace(
|
||||
/href\s*=\s*(["'])\s*javascript:[^"']*\1/gi,
|
||||
'href=$1#$1'
|
||||
);
|
||||
|
||||
const sanitized = DOMPurify.sanitize(safeHtml);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user