fix(community): gemeinsames formatDate, Rechte beim Ausführen, Melden-Dialog abgesichert
formatDate liegt jetzt in pages/format.ts und wird von Meine Karten und der Detailseite genutzt; LOGIN_NEEDED kommt aus account/with-login.ts. Ausblenden, Löschen und Zurückziehen prüfen Admin- bzw. Autor-Recht beim Ausführen (auch nach der Rückfrage). Ein werfendes showModal im Melden-Dialog zeigt einen Hinweis statt eines unbehandelten Fehlers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3cec7151a6
commit
be440bc8e9
7 files changed
+135
-40
No files matched your search
@@ -52,7 +52,7 @@ vi.mock('../account/cards', async (importOriginal) => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
import { formatDate, mountCardsPage } from './cards-page';
|
||||
import { mountCardsPage } from './cards-page';
|
||||
|
||||
const user: User = { $id: 'u1', email: 'a@b.de' };
|
||||
|
||||
@@ -105,17 +105,6 @@ const button = (scope: ParentNode, label: string) =>
|
||||
const dialog = () => document.querySelector<HTMLDialogElement>('dialog.confirm-dialog');
|
||||
const submit = (form: HTMLFormElement) => form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
|
||||
|
||||
describe('formatDate', () => {
|
||||
it('schreibt dd.mm.yyyy', () => {
|
||||
expect(formatDate(new Date(2026, 9, 4, 12).toISOString())).toBe('04.10.2026');
|
||||
expect(formatDate(new Date(2026, 0, 31, 12).toISOString())).toBe('31.01.2026');
|
||||
});
|
||||
|
||||
it('gibt bei unlesbarem Datum nichts zurück', () => {
|
||||
expect(formatDate('kaputt')).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Meine Karten: Zustände', () => {
|
||||
it('abgemeldet: Hinweis und Anmelden-Knopf, keine Anfrage an den Server', async () => {
|
||||
mocks.getCurrentUser.mockResolvedValue(null);
|
||||
|
||||
Reference in new issue
Block a user