LCOV - code coverage report
Current view: top level - packages/design-system/src/components/message - Message.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 50.0 % 6 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <script setup lang="ts">
       2              : import type { HTMLAttributes } from 'vue'
       3              : 
       4              : import { cn } from '@comfyorg/tailwind-utils'
       5              : 
       6              : import Button from '@comfyorg/design-system/button/Button'
       7              : 
       8              : import type { MessageVariants } from './message.variants'
       9              : import { messageVariants } from './message.variants'
      10              : 
      11              : const {
      12              :   severity,
      13              :   closeLabel,
      14              :   closable,
      15              :   class: customClass = ''
      16              : } = defineProps<
      17              :   {
      18              :     severity?: MessageVariants['severity']
      19              :     class?: HTMLAttributes['class']
      20              :   } & (
      21              :     | { closable: true; closeLabel: string }
      22              :     | { closable?: false; closeLabel?: string }
      23              :   )
      24              : >()
      25              : 
      26          167 : const emit = defineEmits<{ close: [event: MouseEvent] }>()
      27          167 : const visible = defineModel<boolean>('visible', { default: true })
      28              : 
      29            0 : function close(event: MouseEvent) {
      30            0 :   visible.value = false
      31            0 :   emit('close', event)
      32              : }
      33              : </script>
      34              : 
      35              : <template>
      36              :   <div
      37              :     v-if="visible"
      38              :     role="alert"
      39              :     aria-live="assertive"
      40              :     aria-atomic="true"
      41              :     :class="cn(messageVariants({ severity }), customClass)"
      42              :   >
      43              :     <span v-if="$slots.icon" class="shrink-0" aria-hidden="true">
      44              :       <slot name="icon" />
      45              :     </span>
      46              :     <div class="min-w-0 flex-1"><slot /></div>
      47              :     <Button
      48              :       v-if="closable"
      49              :       type="button"
      50              :       variant="textonly"
      51              :       size="unset"
      52              :       class="size-6 shrink-0 p-0 text-current"
      53              :       :aria-label="closeLabel"
      54              :       @click="close"
      55              :     >
      56              :       <i class="icon-[lucide--x]" aria-hidden="true" />
      57              :     </Button>
      58              :   </div>
      59              : </template>
        

Generated by: LCOV version 2.0-1