Fix guest demo UX and enforce guest limits

This commit is contained in:
Codex Agent
2026-01-21 21:35:40 +01:00
parent a01a7ec399
commit 80dd12bb92
28 changed files with 812 additions and 118 deletions

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { render, waitFor } from '@testing-library/react';
import { EventBrandingProvider } from '../EventBrandingContext';
import { AppearanceProvider } from '@/hooks/use-appearance';
import type { EventBranding } from '../../types/event-branding';
const sampleBranding: EventBranding = {
@@ -23,6 +24,7 @@ describe('EventBrandingProvider', () => {
document.documentElement.style.removeProperty('color-scheme');
document.documentElement.style.removeProperty('--guest-background');
document.documentElement.style.removeProperty('--guest-font-scale');
localStorage.removeItem('theme');
});
it('applies guest theme classes and variables', async () => {
@@ -44,4 +46,27 @@ describe('EventBrandingProvider', () => {
expect(document.documentElement.classList.contains('guest-theme')).toBe(false);
});
it('respects appearance override in auto mode', async () => {
localStorage.setItem('theme', 'dark');
const autoBranding: EventBranding = {
...sampleBranding,
mode: 'auto',
backgroundColor: '#fff7ed',
};
const { unmount } = render(
<AppearanceProvider>
<EventBrandingProvider branding={autoBranding}>
<div>Guest</div>
</EventBrandingProvider>
</AppearanceProvider>
);
await waitFor(() => {
expect(document.documentElement.classList.contains('dark')).toBe(true);
});
unmount();
});
});