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

mendersoftware / gui / 951400782

pending completion
951400782

Pull #3900

gitlab-ci

web-flow
chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3900: chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

4446 of 6414 branches covered (69.32%)

8342 of 10084 relevant lines covered (82.73%)

186.0 hits per line

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

73.44
/src/js/components/common/configurationobject.js
1
// Copyright 2021 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React, { Fragment, useState } from 'react';
15

16
// material ui
17
import { FileCopyOutlined as CopyToClipboardIcon } from '@mui/icons-material';
18
import { Tooltip } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import copy from 'copy-to-clipboard';
22

23
const useStyles = makeStyles()(theme => ({
58✔
24
  root: {
25
    ['.key > b']: {
26
      backgroundColor: theme.palette.grey[400],
27
      color: theme.palette.getContrastText(theme.palette.grey[400])
28
    }
29
  }
30
}));
31

32
const cutoffLength = 100;
50✔
33
const ValueColumn = ({ value = '', setSnackbar }) => {
50!
34
  const [tooltipVisible, setTooltipVisible] = useState(false);
222✔
35
  const isComponent = React.isValidElement(value);
222✔
36
  const onClick = () => {
222✔
37
    if (setSnackbar) {
×
38
      let copyable = value;
×
39
      if (isComponent) {
×
40
        copyable = value.props.value;
×
41
      }
42
      copy(copyable);
×
43
      setSnackbar('Value copied to clipboard');
×
44
    }
45
  };
46
  let shownValue = value;
222✔
47
  if (!isComponent) {
222✔
48
    shownValue = <div title={value}>{value.length > cutoffLength ? `${value.substring(0, cutoffLength - 3)}...` : value}</div>;
175!
49
  }
50
  return (
222✔
51
    <div
52
      className={`flexbox ${setSnackbar ? 'clickable' : ''}`}
222✔
53
      onClick={onClick}
54
      onMouseEnter={() => setTooltipVisible(true)}
×
55
      onMouseLeave={() => setTooltipVisible(false)}
×
56
    >
57
      {shownValue}
58
      {setSnackbar && (
249✔
59
        <Tooltip title={'Copy to clipboard'} placement="top" open={tooltipVisible}>
60
          <CopyToClipboardIcon color="primary" className={`margin-left-small ${tooltipVisible ? 'fadeIn' : 'fadeOut'}`} fontSize="small"></CopyToClipboardIcon>
27!
61
        </Tooltip>
62
      )}
63
    </div>
64
  );
65
};
66

67
const KeyColumn = ({ value, chipLikeKey }) => (
50✔
68
  <div className={`align-right ${chipLikeKey ? 'key' : ''} muted`}>
232✔
69
    <b>{value}</b>
70
  </div>
71
);
72

73
export const TwoColumns = ({
50✔
74
  className = '',
7✔
75
  children,
76
  chipLikeKey = true,
61✔
77
  compact,
78
  items = {},
×
79
  KeyComponent = KeyColumn,
101✔
80
  KeyProps = {},
101✔
81
  setSnackbar,
82
  style = {},
65✔
83
  ValueComponent = ValueColumn,
91✔
84
  ValueProps = {}
98✔
85
}) => {
86
  const { classes } = useStyles();
101✔
87
  return (
101✔
88
    <div className={`break-all two-columns ${classes.root} ${compact ? 'compact' : ''} ${className}`} style={style}>
101✔
89
      {children
101!
90
        ? children
91
        : Object.entries(items).map(([key, value]) => (
92
            <Fragment key={key}>
232✔
93
              <KeyComponent chipLikeKey={chipLikeKey} value={key} {...KeyProps} />
94
              <ValueComponent setSnackbar={setSnackbar} value={value} {...ValueProps} />
95
            </Fragment>
96
          ))}
97
    </div>
98
  );
99
};
100

101
export const TwoColumnData = ({ className = '', config, ...props }) => <TwoColumns className={`column-data ${className}`} items={config} {...props} />;
83✔
102

103
export const TwoColumnDataMultiple = ({ className = '', config, style, ...props }) => (
50✔
104
  <div className={`two-columns-multiple ${className}`} style={{ ...style }}>
2✔
105
    {Object.entries(config).map(([key, value]) => (
106
      <TwoColumnData className="multiple" config={{ [key]: value }} key={key} compact {...props} />
3✔
107
    ))}
108
  </div>
109
);
110

111
export const ConfigurationObject = ({ config, ...props }) => {
50✔
112
  const content = Object.entries(config).reduce((accu, [key, value]) => {
8✔
113
    accu[key] = `${value}`;
24✔
114
    return accu;
24✔
115
  }, {});
116
  return <TwoColumnData {...props} config={content} />;
8✔
117
};
118

119
export default ConfigurationObject;
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

© 2025 Coveralls, Inc