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

react-ui-org / react-ui / 14189255065

01 Apr 2025 06:59AM UTC coverage: 90.47%. First build
14189255065

Pull #613

github

web-flow
Merge 4789b79f4 into a7d1e91b6
Pull Request #613: Add `writing-tests-guidelines.md` (#612)

770 of 859 branches covered (89.64%)

Branch coverage included in aggregate %.

711 of 778 relevant lines covered (91.39%)

64.99 hits per line

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

80.0
/src/components/Modal/ModalBody.jsx
1
import PropTypes from 'prop-types';
2
import React from 'react';
3
import { withGlobalProps } from '../../providers/globalProps';
4
import { classNames } from '../../helpers/classNames/classNames';
5
import { transferProps } from '../../helpers/transferProps';
6
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
7
import { getScrollingClassName } from './_helpers/getScrollingClassName';
8
import styles from './ModalBody.module.scss';
9

10
export const ModalBody = ({
4✔
11
  children,
12
  scrolling,
13
  ...restProps
14
}) => {
15
  if (isChildrenEmpty(children)) {
20!
16
    return null;
×
17
  }
18

19
  return (
20✔
20
    <div
21
      {...transferProps(restProps)}
22
      className={classNames(
23
        styles.root,
24
        getScrollingClassName(scrolling, styles),
25
      )}
26
    >
27
      {children}
28
    </div>
29
  );
30
};
31

32
ModalBody.defaultProps = {
4✔
33
  children: null,
34
  scrolling: 'auto',
35
};
36

37
ModalBody.propTypes = {
4✔
38
  /**
39
   * Nested elements. Supported types are:
40
   *
41
   * * `ModalContent`
42
   * * `ScrollView` (`scrolling: 'custom'` must be set)
43
   *
44
   * You can also provide a custom component responsible for scrolling and displaying content correctly.
45
   * At most one nested element is allowed. If none are provided nothing is rendered.
46
   */
47
  children: PropTypes.node,
48
  /**
49
   * Scrolling mode:
50
   *
51
   * - `auto`: scrolling is enabled on ModalBody.
52
   * - `custom`: use if providing a custom scrolling component, e.g. an instance of `ScrollView`.
53
   * - `none`: scrolling is disabled on ModalBody and the entire Modal is scrollable instead.
54
   */
55
  scrolling: PropTypes.oneOf(['auto', 'custom', 'none']),
56
};
57

58
export const ModalBodyWithGlobalProps = withGlobalProps(ModalBody, 'ModalBody');
4✔
59

60
export default ModalBodyWithGlobalProps;
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