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

MarkUsProject / Markus / 20143075828

11 Dec 2025 06:18PM UTC coverage: 91.513%. Remained the same
20143075828

Pull #7763

github

web-flow
Merge 9f55e660a into 3421ef3b2
Pull Request #7763: Release 2.9.0

914 of 1805 branches covered (50.64%)

Branch coverage included in aggregate %.

1584 of 1666 new or added lines in 108 files covered. (95.08%)

573 existing lines in 35 files now uncovered.

43650 of 46892 relevant lines covered (93.09%)

121.63 hits per line

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

93.75
/app/javascript/Components/DropDown/SingleSelectDropDown.jsx
1
import React from "react";
2
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
3

4
export class SingleSelectDropDown extends React.Component {
5
  constructor(props) {
6
    super(props);
339✔
7
    this.state = {expanded: false};
339✔
8
  }
9

10
  onSelect = (e, selection) => {
339✔
11
    e.stopPropagation();
26✔
12
    this.props.onSelect(selection);
26✔
13
    this.setState({expanded: false});
26✔
14
  };
15

16
  renderDropdown = (options, selected, expanded, disabled) => {
339✔
17
    if (expanded) {
29!
18
      if (options.length === 0) {
29✔
19
        return (
3✔
20
          <ul>
21
            <li>
22
              <span>{I18n.t("results.filters.no_options")}</span>
23
            </li>
24
          </ul>
25
        );
26
      } else {
27
        return (
26✔
28
          <ul data-testid={"options"}>
29
            {options.map(option => {
30
              if (disabled && disabled.includes(option)) {
118✔
31
                return (
16✔
32
                  <li key={option} className={"disabled"}>
33
                    <span>
34
                      {this.props.valueToDisplayName != null
16!
35
                        ? this.props.valueToDisplayName[option]
36
                        : option}
37
                    </span>
38
                  </li>
39
                );
40
              } else {
41
                return (
102✔
42
                  <li key={option} onClick={e => this.onSelect(e, option)}>
20✔
43
                    <span>
44
                      {this.props.valueToDisplayName != null
102✔
45
                        ? this.props.valueToDisplayName[option]
46
                        : option}
47
                    </span>
48
                  </li>
49
                );
50
              }
51
            })}
52
          </ul>
53
        );
54
      }
55
    }
56
  };
57

58
  renderArrow = () => {
339✔
59
    if (this.state.expanded !== false) {
404✔
60
      return <FontAwesomeIcon className="arrow-up" icon="fa-chevron-up" data-testid={"arrow-up"} />;
29✔
61
    } else {
62
      return (
375✔
63
        <FontAwesomeIcon className="arrow-down" icon="fa-chevron-down" data-testid={"arrow-down"} />
64
      );
65
    }
66
  };
67

68
  render() {
69
    let selected = this.props.selected;
404✔
70
    let options = this.props.options;
404✔
71
    let expanded = this.state.expanded;
404✔
72
    let disabled = this.props.disabled;
404✔
73

74
    return (
404✔
75
      <div
76
        className="dropdown single-select-dropdown"
77
        style={this.props.dropdownStyle}
78
        onClick={() => this.setState({expanded: !this.state.expanded})}
31✔
UNCOV
79
        onBlur={() => this.setState({expanded: false})}
×
80
        tabIndex={-1}
81
        data-testid={"dropdown"}
82
      >
83
        <a data-testid={"selection"} style={this.props.selectionStyle}>
84
          {this.props.valueToDisplayName != null
404✔
85
            ? this.props.valueToDisplayName[this.props.selected]
86
            : this.props.selected}
87
        </a>
88
        {this.renderArrow()}
89
        {!this.props.hideXMark && (
785✔
90
          <div
91
            className="float-right"
92
            onClick={e => {
93
              e.preventDefault();
6✔
94
              this.onSelect(e, this.props.defaultValue);
6✔
95
            }}
96
            data-testid={"reset-dropdown-selection"}
97
          >
98
            <FontAwesomeIcon icon="fa-solid fa-xmark" className={"x-mark"} />
99
          </div>
100
        )}
101
        {expanded && this.renderDropdown(options, selected, expanded, disabled)}
433✔
102
      </div>
103
    );
104
  }
105
}
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