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

caleb531 / flip-book / 10499286139

21 Aug 2024 11:59PM UTC coverage: 25.53% (-2.0%) from 27.541%
10499286139

push

github

caleb531
Convert components to JSX

72 of 100 branches covered (72.0%)

Branch coverage included in aggregate %.

0 of 743 new or added lines in 22 files covered. (0.0%)

54 existing lines in 21 files now uncovered.

386 of 1694 relevant lines covered (22.79%)

6.85 hits per line

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

0.0
/scripts/components/control.jsx
NEW
1
import clsx from "clsx";
×
NEW
2
import PanelComponent from "./panel.jsx";
×
3

4
class ControlComponent {
×
NEW
5
  view({
×
NEW
6
    attrs: {
×
NEW
7
      id,
×
NEW
8
      title,
×
NEW
9
      icon = null,
×
NEW
10
      label = null,
×
NEW
11
      action = null,
×
NEW
12
      panel = null,
×
NEW
13
      panelPosition = "top",
×
NEW
14
    },
×
NEW
15
  }) {
×
NEW
16
    return (
×
NEW
17
      <div
×
NEW
18
        className={clsx("control", `control-${id}`, {
×
NEW
19
          "control-has-label": label,
×
NEW
20
        })}
×
21
      >
NEW
22
        {panel ? (
×
NEW
23
          <PanelComponent id={id} position={panelPosition}>
×
NEW
24
            {panel}
×
NEW
25
          </PanelComponent>
×
NEW
26
        ) : null}
×
NEW
27
        <button
×
NEW
28
          className="control-button"
×
NEW
29
          title={title}
×
NEW
30
          onclick={({ target }) => {
×
NEW
31
            if (panel) {
×
NEW
32
              PanelComponent.togglePanel(id);
×
NEW
33
            } else if (action) {
×
34
              // Do not close the panel where the clicked control resides
NEW
35
              if (!target.closest(".panel")) {
×
NEW
36
                PanelComponent.closeAllPanels();
×
NEW
37
              }
×
NEW
38
              action();
×
39
            }
×
NEW
40
          }}
×
41
        >
NEW
42
          {icon ? (
×
NEW
43
            <img
×
NEW
44
              className="control-icon"
×
NEW
45
              src={`icons/${icon}.svg`}
×
NEW
46
              alt={title}
×
NEW
47
            />
×
NEW
48
          ) : null}
×
NEW
49
          {label ? <span className="control-label">{label}</span> : null}
×
NEW
50
        </button>
×
NEW
51
      </div>
×
52
    );
UNCOV
53
  }
×
UNCOV
54
}
×
55

56
export default ControlComponent;
×
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