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

EcrituresNumeriques / stylo / 14530927847

18 Apr 2025 06:33AM UTC coverage: 35.073% (+1.7%) from 33.412%
14530927847

push

github

web-flow
Ajout des providers Zotero et Hypothesis (#1376)

Co-authored-by: Thomas Parisot <thom4parisot@users.noreply.github.com>

549 of 810 branches covered (67.78%)

Branch coverage included in aggregate %.

501 of 784 new or added lines in 24 files covered. (63.9%)

180 existing lines in 17 files now uncovered.

5393 of 16132 relevant lines covered (33.43%)

2.27 hits per line

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

85.29
/front/src/components/Field.jsx
1
import clsx from 'clsx'
1✔
2
import React, { forwardRef, useEffect, useId, useRef } from 'react'
1✔
3
import styles from './field.module.scss'
1✔
4

5
export default forwardRef(function Field(
1✔
6
  {
127✔
7
    hasError,
127✔
8
    className,
127✔
9
    prefix,
127✔
10
    children,
127✔
11
    label,
127✔
12
    id = useId(),
127✔
13
    type = 'text',
127✔
14
    autoFocus = false,
127✔
15
    ...otherProps
127✔
16
  },
127✔
17
  forwardedRef
127✔
18
) {
127✔
19
  const inputRef = forwardedRef ?? useRef()
127✔
20
  const classNames = clsx(
127✔
21
    styles.field,
127✔
22
    prefix && styles.withPrefix,
127!
23
    'control-field',
127✔
24
    className && className,
127✔
25
    hasError && styles.error
127!
26
  )
127✔
27

28
  const computedStyles = { '--chars-count': prefix?.length }
127!
29
  useEffect(() => {
127✔
30
    if (autoFocus) {
29✔
31
      inputRef.current.focus()
5✔
32
    }
5✔
33
  }, [])
127✔
34

35
  return (
127✔
36
    <div className={classNames}>
127✔
37
      {label && <label htmlFor={id}>{label}</label>}
127✔
38
      <div
127✔
39
        className={clsx('control', otherProps.icon && 'has-icons-left')}
127!
40
        style={computedStyles}
127✔
41
      >
42
        {children && { ...children }}
127!
43
        {!children && (
127✔
44
          <>
127✔
45
            {prefix && <span className={styles.prefix}>{prefix}</span>}
127!
46
            <input
127✔
47
              {...otherProps}
127✔
48
              id={id}
127✔
49
              className="input"
127✔
50
              type={type}
127✔
51
              ref={inputRef}
127✔
52
            />
127✔
53
            {otherProps.icon && (
127!
UNCOV
54
              <span className="icon is-small is-left" aria-hidden>
×
NEW
55
                <otherProps.icon />
×
UNCOV
56
              </span>
×
57
            )}
58
          </>
127✔
59
        )}
60
      </div>
127✔
61
    </div>
127✔
62
  )
63
})
127✔
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