Simplify guest language selector
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { fireEvent, render, screen } from '@testing-library/react';
|
||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
import { LocaleProvider } from '../../i18n/LocaleContext';
|
||||||
|
import { ConsentProvider } from '../../../contexts/consent';
|
||||||
|
import { SettingsSheet } from '../settings-sheet';
|
||||||
|
|
||||||
|
describe('SettingsSheet language section', () => {
|
||||||
|
it('does not render active badge or description text', () => {
|
||||||
|
render(
|
||||||
|
<MemoryRouter>
|
||||||
|
<ConsentProvider>
|
||||||
|
<LocaleProvider>
|
||||||
|
<SettingsSheet />
|
||||||
|
</LocaleProvider>
|
||||||
|
</ConsentProvider>
|
||||||
|
</MemoryRouter>
|
||||||
|
);
|
||||||
|
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'Einstellungen öffnen' }));
|
||||||
|
|
||||||
|
expect(screen.getByText('Sprache')).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText('Wähle deine bevorzugte Sprache für diese Veranstaltung.')).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText('aktiv')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link, useLocation, useParams } from 'react-router-dom';
|
import { Link, useLocation, useParams } from 'react-router-dom';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Badge } from '@/components/ui/badge';
|
|
||||||
import {
|
import {
|
||||||
Sheet,
|
Sheet,
|
||||||
SheetTrigger,
|
SheetTrigger,
|
||||||
@@ -288,7 +287,6 @@ function HomeView({
|
|||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="pb-3">
|
<CardHeader className="pb-3">
|
||||||
<CardTitle>{t('settings.language.title')}</CardTitle>
|
<CardTitle>{t('settings.language.title')}</CardTitle>
|
||||||
<CardDescription>{t('settings.language.description')}</CardDescription>
|
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
@@ -308,14 +306,6 @@ function HomeView({
|
|||||||
>
|
>
|
||||||
<span aria-hidden className="text-lg leading-none">{option.flag}</span>
|
<span aria-hidden className="text-lg leading-none">{option.flag}</span>
|
||||||
<span className="font-medium">{t(`settings.language.option.${option.code}`)}</span>
|
<span className="font-medium">{t(`settings.language.option.${option.code}`)}</span>
|
||||||
{isActive && (
|
|
||||||
<Badge
|
|
||||||
variant="secondary"
|
|
||||||
className="border border-white/40 bg-white/10 text-[10px] uppercase tracking-wide text-white"
|
|
||||||
>
|
|
||||||
{t('settings.language.activeBadge')}
|
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -684,8 +684,6 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
|||||||
subtitle: 'Verwalte deinen Gastzugang, rechtliche Dokumente und lokale Daten.',
|
subtitle: 'Verwalte deinen Gastzugang, rechtliche Dokumente und lokale Daten.',
|
||||||
language: {
|
language: {
|
||||||
title: 'Sprache',
|
title: 'Sprache',
|
||||||
description: 'Wähle deine bevorzugte Sprache für diese Veranstaltung.',
|
|
||||||
activeBadge: 'aktiv',
|
|
||||||
option: {
|
option: {
|
||||||
de: 'Deutsch',
|
de: 'Deutsch',
|
||||||
en: 'English',
|
en: 'English',
|
||||||
@@ -1439,8 +1437,6 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
|||||||
subtitle: 'Manage your guest access, legal documents, and local data.',
|
subtitle: 'Manage your guest access, legal documents, and local data.',
|
||||||
language: {
|
language: {
|
||||||
title: 'Language',
|
title: 'Language',
|
||||||
description: 'Choose your preferred language for this event.',
|
|
||||||
activeBadge: 'active',
|
|
||||||
option: {
|
option: {
|
||||||
de: 'German',
|
de: 'German',
|
||||||
en: 'English',
|
en: 'English',
|
||||||
|
|||||||
Reference in New Issue
Block a user