All files / src/components/shared ShTextField.vue

80% Statements 4/5
100% Branches 2/2
0% Functions 0/1
80% Lines 4/5

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 37 38 39 40 41 42 43 44 45 46 47 48 49 50  13x                                                                               27x         27x 27x    
<template>
  <div class="new-style py-1">
    <label
      v-if="!!label"
      class="pl-0 pb-2 sh-label"
      :for="props.id"
      data-testid="label"
    >
      <span>{{ props.label }}</span>
    </label>
    <v-text-field
      v-bind="attrs"
      :v-slot="slots"
      class="pt-2"
      bg-color="white"
      variant="outlined"
      density="comfortable"
      clearable
    >
      <template
        v-for="(_, name) in slots"
        v-slot:[name]="slotData"
      >
        <slot
          :name="name"
          v-bind="slotData"
        ></slot>
      </template>
    </v-text-field>
  </div>
</template>
 
<script setup lang="ts">
import { v4 } from 'uuid';
import { useAttrs, useSlots } from 'vue';
 
interface Props {
  id?: string;
  label?: string;
}
 
const props = withDefaults(defineProps<Props>(), {
  id: v4(),
  label: '',
});
 
const attrs = useAttrs();
const slots = useSlots();
</script>