feat: Landing Page and Login/Register Modal 1.00

This commit is contained in:
OpenVelo Agent
2026-07-21 18:46:12 +00:00
parent 2c124929a6
commit 24059bdf0d
5 changed files with 75 additions and 357 deletions
+36
View File
@@ -0,0 +1,36 @@
import { renderMarkdownToHtml } from '../../frontend/src/app/core/services/markdown.pure';
describe('Landing welcome binding (mirrors landing.component.ts/.html)', () => {
function welcomeHtmlFor(payload: { welcomeMarkdown: string } | null | undefined): string {
return renderMarkdownToHtml(payload?.welcomeMarkdown ?? '');
}
it('renders the welcome Markdown from the bootstrap payload', () => {
const html = welcomeHtmlFor({
welcomeMarkdown: '# Welcome\n\nCreate the first admin to get started.',
});
expect(typeof html).toBe('string');
expect(html).toContain('<h1>Welcome</h1>');
expect(html).toContain('Create the first admin to get started.');
expect(html).not.toContain('=>{if');
});
it('produces a safe empty string when payload is missing', () => {
expect(typeof welcomeHtmlFor(null)).toBe('string');
expect(welcomeHtmlFor(null)).not.toContain('=>{if');
});
it('produces a safe empty string when welcomeMarkdown is empty', () => {
expect(typeof welcomeHtmlFor({ welcomeMarkdown: '' })).toBe('string');
expect(welcomeHtmlFor({ welcomeMarkdown: '' })).not.toContain('=>{if');
});
it('keeps sanitization when the welcome Markdown contains hostile content', () => {
const html = welcomeHtmlFor({
welcomeMarkdown: '# Hello\n\n<script>alert(1)</script>\n\n[bad](javascript:alert(1))',
});
expect(html).toContain('<h1>Hello</h1>');
expect(html).not.toContain('<script>');
expect(html).not.toMatch(/href="javascript:/i);
});
});