merge: combine all features from both codebases - mobile dashboard + layer panel + notifications + shares + all fixes

This commit is contained in:
Leopoldadmin
2026-07-04 16:43:55 +02:00
parent 0606dbb501
commit be62470b53
79 changed files with 9562 additions and 3132 deletions
+55
View File
@@ -0,0 +1,55 @@
/**
* InlineTextEditor Tests
*/
import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import InlineTextEditor from '../src/components/InlineTextEditor';
describe('InlineTextEditor', () => {
it('should render with initial text', () => {
render(<InlineTextEditor initialText="Hello" onSubmit={() => {}} onCancel={() => {}} />);
const input = screen.getByDisplayValue('Hello');
expect(input).toBeDefined();
});
it('should call onSubmit with text when Enter is pressed', () => {
const onSubmit = vi.fn();
render(<InlineTextEditor initialText="Test" onSubmit={onSubmit} onCancel={() => {}} />);
const input = screen.getByDisplayValue('Test');
fireEvent.keyDown(input, { key: 'Enter' });
expect(onSubmit).toHaveBeenCalledWith('Test');
});
it('should call onCancel when Escape is pressed', () => {
const onCancel = vi.fn();
render(<InlineTextEditor initialText="Test" onSubmit={() => {}} onCancel={onCancel} />);
const input = screen.getByDisplayValue('Test');
fireEvent.keyDown(input, { key: 'Escape' });
expect(onCancel).toHaveBeenCalled();
});
it('should update text when typing', () => {
const onSubmit = vi.fn();
render(<InlineTextEditor initialText="" onSubmit={onSubmit} onCancel={() => {}} />);
const input = screen.getByRole('textbox') as HTMLInputElement;
fireEvent.change(input, { target: { value: 'New Text' } });
fireEvent.keyDown(input, { key: 'Enter' });
expect(onSubmit).toHaveBeenCalledWith('New Text');
});
it('should call onSubmit when confirm button is clicked', () => {
const onSubmit = vi.fn();
render(<InlineTextEditor initialText="Initial" onSubmit={onSubmit} onCancel={() => {}} />);
const confirmBtn = screen.getByText('Bestätigen (Enter)');
fireEvent.click(confirmBtn);
expect(onSubmit).toHaveBeenCalledWith('Initial');
});
it('should call onCancel when cancel button is clicked', () => {
const onCancel = vi.fn();
render(<InlineTextEditor initialText="" onSubmit={() => {}} onCancel={onCancel} />);
const cancelBtn = screen.getByText('Abbrechen (Esc)');
fireEvent.click(cancelBtn);
expect(onCancel).toHaveBeenCalled();
});
});