fix: hover card maiden name false positive, editor placeholder on non-empty content, mention persistence #375
@@ -363,6 +363,38 @@ describe('PersonMentionEditor — XSS resistance', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ─── Placeholder behavior ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
describe('PersonMentionEditor — placeholder behavior', () => {
|
||||||
|
it('sets data-placeholder on the inner element when editor is empty', async () => {
|
||||||
|
render(PersonMentionEditorHost, {
|
||||||
|
initialValue: '',
|
||||||
|
initialMentions: [],
|
||||||
|
placeholder: 'Gib Text ein...',
|
||||||
|
onChange: () => {}
|
||||||
|
});
|
||||||
|
await vi.waitFor(() => {
|
||||||
|
const inner = document.querySelector('.tiptap-editor-inner') as HTMLElement | null;
|
||||||
|
expect(inner).not.toBeNull();
|
||||||
|
expect(inner!.getAttribute('data-placeholder')).toBe('Gib Text ein...');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('omits data-placeholder on the inner element when editor has content', async () => {
|
||||||
|
render(PersonMentionEditorHost, {
|
||||||
|
initialValue: 'Bestehender Text',
|
||||||
|
initialMentions: [],
|
||||||
|
placeholder: 'Gib Text ein...',
|
||||||
|
onChange: () => {}
|
||||||
|
});
|
||||||
|
await vi.waitFor(() => {
|
||||||
|
const inner = document.querySelector('.tiptap-editor-inner') as HTMLElement | null;
|
||||||
|
expect(inner).not.toBeNull();
|
||||||
|
expect(inner!.hasAttribute('data-placeholder')).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// ─── Touch target (WCAG 2.2 AA) ──────────────────────────────────────────────
|
// ─── Touch target (WCAG 2.2 AA) ──────────────────────────────────────────────
|
||||||
|
|
||||||
describe('PersonMentionEditor — touch target', () => {
|
describe('PersonMentionEditor — touch target', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user