LCOV - code coverage report
Current view: top level - packages/design-system/src/components/select - useSelectSearch.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 3 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { useFuse } from '@vueuse/integrations/useFuse'
       2              : import type { MaybeRefOrGetter, Ref } from 'vue'
       3              : import { computed, toValue } from 'vue'
       4              : 
       5              : import type { SelectOption } from './types'
       6              : 
       7          179 : export function useSelectSearch<Value extends string | number>(
       8              :   query: Ref<string>,
       9              :   options: MaybeRefOrGetter<SelectOption<Value>[]>
      10              : ) {
      11          179 :   const { results } = useFuse(query, options, {
      12              :     fuseOptions: { keys: ['name', 'value'], threshold: 0.3 },
      13              :     matchAllWhenSearchEmpty: true
      14              :   })
      15              : 
      16          179 :   return computed(() =>
      17              :     query.value.trim()
      18              :       ? results.value.map(({ item }) => item)
      19              :       : toValue(options)
      20              :   )
      21              : }
        

Generated by: LCOV version 2.0-1