All files / src/components/modal/actions Action.vue

100% Statements 2/2
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2

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                              23x                 9x                                                
<template>
  <template v-if="variant === 'button'">
    <v-tooltip
      location="top"
      open-delay="1000"
    >
      <template #activator="{ props: tooltip }">
        <v-btn
          v-bind="mergeProps($attrs, tooltip)"
          data-testid="button"
          variant="text"
          :color="color"
          :icon="icon"
        />
      </template>
      <span>{{ text }}</span>
    </v-tooltip>
  </template>
  <template v-if="variant == 'menu-item'">
    <v-list-item
      v-bind="$attrs"
      data-testid="menu-item"
      :prepend-icon="icon"
    >
      <v-list-item-title>{{ text }}</v-list-item-title>
    </v-list-item>
  </template>
</template>
 
<script setup lang="ts">
import { mergeProps } from 'vue';
 
interface Props {
  text: string;
  icon: string;
  color?: string;
  variant?: 'button' | 'menu-item';
}
 
withDefaults(defineProps<Props>(), {
  color: 'white',
  variant: 'button',
});
 
defineOptions({
  inheritAttrs: false,
});
</script>