• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

skmtc / skmtc / 18384956961

09 Oct 2025 06:08PM UTC coverage: 37.986% (-0.2%) from 38.143%
18384956961

push

github

dmitrigrabov
Skip broken test

406 of 486 branches covered (83.54%)

Branch coverage included in aggregate %.

4185 of 11600 relevant lines covered (36.08%)

11.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.0
/deno/cli/components/MultiselectTask.tsx
1
import React from 'react'
4✔
2
import { Text } from 'ink'
4✔
3
import { MultiSelect } from '@inkjs/ui'
4✔
4
import { useId, useState } from 'react'
4✔
5
import type { Option } from '@/components/types.ts'
6
import { TaskBox } from './TaskBox.tsx'
4✔
7
import { TaskContainer } from './TaskContainer.tsx'
4✔
8
import { useShortcut } from './useShortcut.tsx'
4✔
9
import { useTask } from './TaskContext.tsx'
4✔
10

11
type MultiselectTaskProps = {
12
  prompt: string
13
  options: Option[]
14
  setValues: (values: string[]) => void
15
}
16
export const MultiselectTask = ({ prompt, options, setValues }: MultiselectTaskProps) => {
×
17
  const { dispatch } = useTask()
×
18
  const [response, setResponse] = useState<string | null>(null)
×
19
  const [submitted, setSubmitted] = useState(false)
×
20
  const [error, setError] = useState<string | null>(null)
×
21
  const id = useId()
×
22

23
  useShortcut({
×
24
    key: 'space',
×
25
    name: 'toggle',
×
26
    action: (input, key) => {
×
27
      // behaviour handled in MultiSelect component
28
    }
×
29
  })
×
30

31
  useShortcut({
×
32
    key: 'enter',
×
33
    name: 'submit',
×
34
    action: (input, key) => {
×
35
      // behaviour handled in MultiSelect component
36
    }
×
37
  })
×
38

39
  if (submitted) {
×
40
    return (
×
41
      <TaskBox prompt={prompt} id={`${id}-result`} active={false}>
×
42
        <Text dimColor>{response}</Text>
×
43
      </TaskBox>
44
    )
45
  }
×
46

47
  return (
×
48
    <TaskContainer prompt={prompt}>
×
49
      <MultiSelect
×
50
        options={options}
×
51
        onChange={values => setResponse(values.join(', '))}
×
52
        visibleOptionCount={7}
×
53
        onSubmit={values => {
×
54
          if (!values.length) {
×
55
            setError('No values selected')
×
56
            console.error('No values selected')
×
57

58
            return
×
59
          }
×
60

61
          setValues(values)
×
62
          setResponse(values.join(', '))
×
63
          dispatch({ type: 'increment-current-task' })
×
64
          setSubmitted(true)
×
65
        }}
×
66
      />
67
      {error && <Text color="red">{error}</Text>}
×
68
    </TaskContainer>
69
  )
70
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc