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

electron / fiddle / 6830352908

10 Nov 2023 10:49PM CUT coverage: 87.23% (-0.03%) from 87.257%
6830352908

Pull #1502

github

web-flow
Merge 512712673 into 41b0600cb
Pull Request #1502: feat: add support for JSON files in editors

957 of 1191 branches covered (0.0%)

Branch coverage included in aggregate %.

15 of 18 new or added lines in 6 files covered. (83.33%)

3688 of 4134 relevant lines covered (89.21%)

32.47 hits per line

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

0.0
/src/renderer/components/output-editors-wrapper.tsx
1
import * as React from 'react';
×
2

3
import { reaction } from 'mobx';
×
4
import { Mosaic, MosaicNode, MosaicParent } from 'react-mosaic-component';
×
5

6
import { Editors } from './editors';
×
7
import { Outputs } from './outputs';
×
8
import { Sidebar } from './sidebar';
×
9
import { AppState } from '../state';
10

11
interface WrapperProps {
12
  appState: AppState;
13
}
14

15
interface WrapperState {
16
  mosaic: MosaicNode<WrapperEditorId>;
17
  focusable: boolean;
18
}
19

20
export type WrapperEditorId = 'output' | 'editors' | 'sidebar';
21

22
export class OutputEditorsWrapper extends React.Component<
×
23
  WrapperProps,
24
  WrapperState
25
> {
26
  private MOSAIC_ELEMENTS = {
×
27
    output: <Outputs appState={this.props.appState} />,
28
    editors: <Editors appState={this.props.appState} />,
29
    sidebar: <Sidebar appState={this.props.appState} />,
30
  };
31

32
  constructor(props: any) {
33
    super(props);
×
34
    this.state = {
×
35
      mosaic: {
36
        direction: 'column',
37
        first: 'output',
38
        second: {
39
          direction: 'row',
40
          first: 'sidebar',
41
          second: 'editors',
42
          splitPercentage: 15,
43
        },
44
        splitPercentage: 25,
45
      },
46
      focusable: true,
47
    };
48
    reaction(
×
49
      () => this.props.appState.isSettingsShowing,
×
50
      (isSettingsShowing) => this.setState({ focusable: !isSettingsShowing }),
×
51
    );
52
  }
53

54
  public render() {
55
    return (
×
56
      <Mosaic<WrapperEditorId>
57
        renderTile={(id: string) =>
58
          this.MOSAIC_ELEMENTS[id as keyof typeof this.MOSAIC_ELEMENTS]
×
59
        }
60
        resize={{ minimumPaneSizePercentage: 15 }}
61
        value={this.state.mosaic}
62
        onChange={this.onChange}
63
        className={!this.state.focusable ? 'tabbing-hidden' : undefined}
×
64
      />
65
    );
66
  }
67

68
  private onChange = (rootNode: MosaicParent<WrapperEditorId>) => {
×
69
    const isConsoleShowing = rootNode.splitPercentage !== 0;
×
70

71
    if (isConsoleShowing !== this.props.appState.isConsoleShowing) {
×
72
      this.props.appState.isConsoleShowing = isConsoleShowing;
×
73
    }
74
    this.setState({ mosaic: rootNode });
×
75
  };
76
}
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