diff --git a/src/Components/Input/ComboBoxInput.spec.tsx b/src/Components/Input/ComboBoxInput.spec.tsx new file mode 100644 index 00000000..86202f4b --- /dev/null +++ b/src/Components/Input/ComboBoxInput.spec.tsx @@ -0,0 +1,32 @@ +import { render, screen, fireEvent } from '@testing-library/react' +import { describe, it, expect, beforeEach, vi } from 'vitest' + +import ComboBoxInput from './ComboBoxInput' + +describe('', () => { + let wrapper: ReturnType + + const updateFormValue = vi.fn() + + beforeEach(() => { + vi.clearAllMocks() + wrapper = render( + , + ) + }) + + it('renders properly', () => { + expect(wrapper.container.firstChild).toMatchSnapshot() + }) + + describe('handleChange', () => { + it('calls updateFormValue with new value', () => { + fireEvent.change(screen.getByRole('combobox'), { target: { value: 'Option 2' } }) + expect(updateFormValue).toBeCalledWith('Option 2') + }) + }) +}) diff --git a/src/Components/Input/__snapshots__/ComboBoxInput.spec.tsx.snap b/src/Components/Input/__snapshots__/ComboBoxInput.spec.tsx.snap new file mode 100644 index 00000000..18ef547d --- /dev/null +++ b/src/Components/Input/__snapshots__/ComboBoxInput.spec.tsx.snap @@ -0,0 +1,18 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[` > renders properly 1`] = ` + +`;