fix(tests): resolve all 4 pre-existing test failures
- CommentThread: add missing empty-state paragraph using comment_empty_hint i18n key (key existed but was never rendered in the template) - TranscriptionBlock: add selectedQuote hint using transcription_block_quote_hint i18n key (key existed but was never rendered); fix test to use native DOM el.focus()/setSelectionRange()/dispatchEvent instead of locator.selectText() which is not available in this vitest-browser version - TranscriptionEditView: fix test to use native el.dispatchEvent(FocusEvent) instead of locator.blur() which is not available - Conversations: fix test expected text from stale "Korrespondenz durchsuchen" to match current conv_empty_heading() = "Wessen Briefe möchten Sie lesen?" All 687 tests now pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -199,7 +199,9 @@ onMount(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if flatMessages.length > 0}
|
||||
{#if flatMessages.length === 0}
|
||||
<p class="text-sm text-ink-3 italic">{m.comment_empty_hint()}</p>
|
||||
{:else}
|
||||
<div class="rounded border-l-2 border-accent bg-muted p-2">
|
||||
<div class="mb-2 flex items-center gap-1.5 font-sans text-sm font-semibold text-ink-2">
|
||||
<svg
|
||||
|
||||
@@ -182,6 +182,10 @@ function handleTextareaMouseUp() {
|
||||
onmouseup={handleTextareaMouseUp}
|
||||
></textarea>
|
||||
|
||||
{#if selectedQuote}
|
||||
<p class="mt-1 text-xs text-ink-3">{m.transcription_block_quote_hint()}</p>
|
||||
{/if}
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="flex items-center justify-between border-t border-line pt-2">
|
||||
<div>
|
||||
|
||||
@@ -228,12 +228,12 @@ describe('TranscriptionBlock — delete confirmation', () => {
|
||||
describe('TranscriptionBlock — quote selection', () => {
|
||||
it('shows quote hint after text is selected in textarea', async () => {
|
||||
renderBlock({ text: 'Breslau, den 12. August' });
|
||||
const textarea = page.getByRole('textbox');
|
||||
// Select all text via keyboard shortcut to trigger mouseup with selection
|
||||
await textarea.click();
|
||||
await textarea.selectText();
|
||||
// Fire mouseup to trigger the selection handler
|
||||
await textarea.dispatchEvent('mouseup');
|
||||
await page.getByRole('textbox').click();
|
||||
// Select text and fire mouseup via native DOM — locator.selectText/dispatchEvent not available
|
||||
const el = document.querySelector('textarea') as HTMLTextAreaElement;
|
||||
el.focus();
|
||||
el.setSelectionRange(0, el.value.length);
|
||||
el.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
|
||||
await expect.element(page.getByText(/Zitat/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -193,8 +193,9 @@ describe('TranscriptionEditView — flush on blur', () => {
|
||||
const textarea = page.getByRole('textbox').first();
|
||||
await textarea.fill('Blur text');
|
||||
|
||||
// Blur before 1500ms debounce fires
|
||||
await textarea.blur();
|
||||
// Blur before 1500ms debounce fires — locator.blur() not available, use native DOM
|
||||
const el = document.querySelector('textarea') as HTMLTextAreaElement;
|
||||
el.dispatchEvent(new FocusEvent('blur', { bubbles: true }));
|
||||
|
||||
await vi.runAllTimersAsync();
|
||||
expect(onSaveBlock).toHaveBeenCalledWith('b1', 'Blur text');
|
||||
|
||||
@@ -50,7 +50,7 @@ const withDocs = {
|
||||
describe('Conversations page – empty state', () => {
|
||||
it('shows the empty-state heading when no persons are selected', async () => {
|
||||
render(Page, { data: baseData });
|
||||
await expect.element(page.getByText(/Korrespondenz durchsuchen/i)).toBeInTheDocument();
|
||||
await expect.element(page.getByText(/Wessen Briefe möchten Sie lesen/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hides the swap button when no persons are selected', async () => {
|
||||
|
||||
Reference in New Issue
Block a user