Skip to content

Commit

Permalink
more searchform tests (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonjetz authored Nov 27, 2023
1 parent f58b7f0 commit 7799178
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/fragmentarium/ui/SearchForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7799178

Please sign in to comment.