diff --git a/src/lib/elements/forms/inputText.svelte b/src/lib/elements/forms/inputText.svelte index 0da7f7b388..2c69fa8e49 100644 --- a/src/lib/elements/forms/inputText.svelte +++ b/src/lib/elements/forms/inputText.svelte @@ -1,5 +1,5 @@ -{#if selectedAttribute} - - - - {option?.name} - {#if option?.type === 'relationship'} - - Beta - - {/if} - - - + + + + {option?.name} + {#if option?.type === 'relationship'} + + Beta + + {/if} + + + + {#if selectedAttribute} {#if selectedAttribute?.type !== 'relationship'} (option = null)} /> {/if} - - - (showEdit = false)}>Cancel - Update - - -{/if} + {/if} + + + (showEdit = false)}>Cancel + Update + + diff --git a/tests/unit/elements/inputText.test.ts b/tests/unit/elements/inputText.test.ts index e2f6f5dff8..2c2ef2c6bb 100644 --- a/tests/unit/elements/inputText.test.ts +++ b/tests/unit/elements/inputText.test.ts @@ -2,6 +2,7 @@ import { expect, test } from 'vitest'; import { render } from '@testing-library/svelte'; import userEvent from '@testing-library/user-event'; import { InputText } from '../../../src/lib/elements/forms'; +import { tick } from 'svelte'; test('shows text input', () => { const { getByText, getByLabelText } = render(InputText, { id: 'input', label: 'input' }); @@ -24,9 +25,9 @@ test('shows text input - disabled', () => { expect(getByLabelText('input')).toBeDisabled(); }); -test('shows text input - autofocus', () => { +test('shows text input - autofocus', async () => { const { getByLabelText } = render(InputText, { id: 'input', label: 'input', autofocus: true }); - + await tick(); expect(getByLabelText('input')).toHaveFocus(); });