LCOV - code coverage report
Current view: top level - src/platform/workspace/components - UploadModelFilePicker.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 8.3 % 12 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2            0 :   <div class="flex flex-col gap-2">
       3              :     <label
       4              :       ref="dropRef"
       5              :       :class="
       6              :         cn(
       7              :           'flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-4 text-center transition-colors focus-within:border-muted-foreground',
       8              :           isOverDropZone
       9              :             ? 'border-muted-foreground'
      10              :             : 'border-border hover:border-muted-foreground'
      11              :         )
      12              :       "
      13              :       data-attr="upload-model-file-drop"
      14              :       @dragenter.stop
      15              :       @dragleave.stop
      16              :       @dragover.prevent.stop
      17              :       @drop.prevent.stop
      18              :     >
      19              :       <input
      20              :         type="file"
      21              :         accept=".safetensors"
      22              :         class="sr-only"
      23              :         data-testid="upload-model-file-input"
      24              :         @change="onFileChange"
      25              :       />
      26              :       <span class="text-muted-foreground">
      27              :         {{ $t('assetBrowser.fileUpload.drop') }}
      28              :       </span>
      29              :       <span
      30              :         class="rounded-md bg-secondary px-3 py-1.5 font-medium text-foreground"
      31              :       >
      32              :         {{ $t('assetBrowser.fileUpload.choose') }}
      33              :       </span>
      34              :     </label>
      35              :     <p v-if="error" class="m-0 text-destructive">
      36              :       {{ error }}
      37              :     </p>
      38              :   </div>
      39              : </template>
      40              : 
      41              : <script setup lang="ts">
      42              : import { useDropZone } from '@vueuse/core'
      43              : import { ref } from 'vue'
      44              : 
      45              : import { cn } from '@comfyorg/tailwind-utils'
      46              : 
      47              : const { error } = defineProps<{
      48              :   error?: string
      49              : }>()
      50              : 
      51            0 : const emit = defineEmits<{
      52              :   choose: [file: File]
      53              : }>()
      54              : 
      55            0 : const dropRef = ref<HTMLElement | null>(null)
      56              : 
      57            0 : const { isOverDropZone } = useDropZone(dropRef, {
      58              :   multiple: false,
      59              :   onDrop(files) {
      60            0 :     const file = files?.[0]
      61            0 :     if (file) emit('choose', file)
      62              :   }
      63              : })
      64              : 
      65            0 : function onFileChange(event: Event) {
      66            0 :   if (!(event.target instanceof HTMLInputElement)) return
      67            0 :   const file = event.target.files?.[0]
      68            0 :   event.target.value = ''
      69            0 :   if (file) emit('choose', file)
      70              : }
      71              : </script>
        

Generated by: LCOV version 2.0-1