From 77991782ccbbef0c23b680cbbeebceac04d18e73 Mon Sep 17 00:00:00 2001 From: fsimonjetz Date: Mon, 27 Nov 2023 13:36:47 +0100 Subject: [PATCH] more searchform tests (#416) --- src/fragmentarium/ui/SearchForm.test.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/fragmentarium/ui/SearchForm.test.tsx b/src/fragmentarium/ui/SearchForm.test.tsx index 282645553..20f164df2 100644 --- a/src/fragmentarium/ui/SearchForm.test.tsx +++ b/src/fragmentarium/ui/SearchForm.test.tsx @@ -90,12 +90,29 @@ beforeEach(async () => { }) describe('User Input', () => { - it('Displys User Input in NumbersSearchForm', async () => { + it('Displays User Input in NumbersSearchForm', async () => { const userInput = 'RN0' userEvent.type(screen.getByLabelText('Number'), userInput) expect(screen.getByLabelText('Number')).toHaveValue(userInput) }) + it('Shows feedback on invalid number input in NumbersSearchForm', async () => { + const userInput = '*.*.*' + userEvent.type(screen.getByLabelText('Number'), userInput) + expect( + screen.getByText( + 'At least one of prefix, number or suffix must be specified.' + ) + ).toBeVisible() + expect(screen.getByText('Search')).toBeDisabled() + }) + + it('Displys User Input in PagesSearchForm', async () => { + const userInput = '1-2' + userEvent.type(screen.getByLabelText('Pages'), userInput) + expect(screen.getByLabelText('Pages')).toHaveValue(userInput) + }) + it('Displays User Input in TranslierationSearchForm', async () => { const userInput = 'ma i-ra\nka li' userEvent.type(screen.getByLabelText('Transliteration'), userInput)