All files / apps/huella-legal/layers/forms/app/components FormErrorSummary.vue

100% Statements 6/6
100% Branches 1/1
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36    128x               7x 48x     48x     48x       28x                            
<template>
    <UAlert
        v-if="errors.length"
        role="alert"
        color="error"
        variant="subtle"
        icon="i-lucide-circle-alert"
        :title="$t('formErrorSummary.title', errors.length)"
    >
        <template #description>
            <ul class="list-disc pl-5">
                <li v-for="{ id, label, message } in errors" :key="id">
                    <I18nT keypath="formErrorSummary.item" scope="global">
                        <template #field>
                            <a :href="`#${id}`" class="underline">{{ label }}</a>
                        </template>
                        <template #message>
                            {{ message }}
                        </template>
                    </I18nT>
                </li>
            </ul>
        </template>
    </UAlert>
</template>
 
<script setup lang="ts">
import type { FieldError } from "../types/FieldError";
 
interface Props {
    errors: readonly FieldError[];
}
 
defineProps<Props>();
</script>