Skip to content

Commit

Permalink
make sure FormListUniqueSelection shows backend validation
Browse files Browse the repository at this point in the history
Change-Id: I1d0384a54262221a0ad59679e2c6cba9e169828e
  • Loading branch information
BenediktSeidl committed Feb 13, 2025
1 parent 1518ffe commit 4210ef4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CmkList from '@/components/CmkList'
import formListActions from '@/form/components/forms/utils/formListActions'
import type { ListUniqueSelection } from 'cmk-shared-typing/typescript/vue_formspec_components'
import { useFormEditDispatcher } from '@/form/private'
import FormValidation from '@/form/components/FormValidation.vue'

const props = defineProps<{
spec: ListUniqueSelection
Expand Down Expand Up @@ -105,4 +106,5 @@ const { FormEditDispatcher } = useFormEditDispatcher()
/>
</template>
</CmkList>
<FormValidation :validation="validation"></FormValidation>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ test('FormListUniqueSelection unique element only shows once', async () => {
await fireEvent.click(secondSingleChoiceElement)
expect(queryByText(secondSingleChoiceElement, 'Choice 1')).toBeNull()
})

test('FormListUniqueSelection shows backend validation pointing to list', async () => {
render(FormEdit, {
props: {
spec: listSpec,
data: [],
backendValidation: [{ location: [], message: 'Backend error message', invalid_value: [] }]
}
})
screen.getByText('Backend error message')
})

0 comments on commit 4210ef4

Please sign in to comment.