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

zooniverse / front-end-monorepo / 13446939073

20 Feb 2025 11:54PM UTC coverage: 75.515%. Remained the same
13446939073

Pull #6581

github

web-flow
Merge ba3260a1b into f61207d68
Pull Request #6581: refactor: image loading handlers

10852 of 16567 branches covered (65.5%)

Branch coverage included in aggregate %.

29 of 32 new or added lines in 6 files covered. (90.63%)

1 existing line in 1 file now uncovered.

16958 of 20260 relevant lines covered (83.7%)

399.38 hits per line

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

89.09
/packages/lib-react-components/src/Media/components/Text/Text.js
1
import { Box } from 'grommet'
1✔
2
import styled, { css, useTheme } from 'styled-components'
1✔
3

4
import { propTypes, defaultProps } from '../../helpers/mediaPropTypes'
1✔
5
import { useTextData } from '../../../hooks'
421✔
6

7
const StyledBox = styled(Box)`
1✔
8
  ${props => props.maxHeight && css`max-height: ${props.maxHeight}px;`}
7✔
9
  ${props => props.maxWidth && css`max-width: ${props.maxWidth}px;`}
7✔
10
`
11

12
const StyledPre = styled.pre`
1✔
13
  white-space: pre-wrap;
14
  color: ${props => props.theme.dark ? 'white' : 'black'};
7!
15
  font-family: 'Anonymous Pro', monospace;
16
  font-weight: 400;
17
  @font-face {
18
    font-family: 'Anonymous Pro';
19
    font-style: normal;
20
    font-weight: 400;
21
    src:
22
      local('Anonymous Pro'),
23
      local('Anonymous Pro-Regular'),
24
      url(https://fonts.gstatic.com/s/anonymouspro/v21/rP2Bp2a15UIB7Un-bOeISG3pHls29QP-4Ks.woff2) 
25
      format('woff2');
26
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
27
  }
28
  overflow-y: scroll;
29
`
30

31
export default function Text({
32
  alt = defaultProps.alt,
7✔
33
  controls = defaultProps.controls,
7✔
34
  flex = defaultProps.flex,
7✔
35
  height = '200',
7✔
36
  src = defaultProps.src,
7!
37
  width = defaultProps.width,
7✔
38
  ...rest
7✔
39
}) {
7✔
40
  const theme = useTheme()
7✔
41
  const { data, error, loading } = useTextData(src)
7✔
42
  let content = null
7✔
43

44
  if (loading) {
7✔
45
    content = null
7✔
46
  }
47

48
  if (error) {
7!
49
    content = <p>{error.message}</p>
×
50
  }
51

52
  if (data) {
7!
UNCOV
53
    content = data
×
54
  }
55

56
  return (
7✔
57
    <StyledBox
58
      a11yTitle={alt}
59
      flex={flex}
60
      forwardedAs='section'
61
      height='100%'
62
      maxWidth={width}
63
      maxHeight={height}
64
      pad={{ horizontal: 'xsmall', top: 'xsmall', bottom: 'medium' }}
65
      width='100%'
66
      {...rest}
67
    >
68
      <StyledPre
69
        tabIndex='0'
70
        theme={theme}
71
      >
72
        {content}
73
      </StyledPre>
74
    </StyledBox>
75
  )
76
}
77

78
Text.propTypes = {
1✔
79
  ...propTypes
80
}
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