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

mac-s-g / react-json-view / #1389

30 Jun 2022 04:19PM UTC coverage: 77.969% (+24.9%) from 53.039%
#1389

push

web-flow
Merge pull request #3 from grapherjs/feat/highlighter

feat: add highlighter effect on object keys as well

290 of 379 branches covered (76.52%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 2 files covered. (100.0%)

77 existing lines in 9 files now uncovered.

524 of 665 relevant lines covered (78.8%)

41.73 hits per line

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

62.5
/src/js/components/ObjectKeyModal/AddKeyRequest.js
1
import React from 'react';
2
import dispatcher from './../../helpers/dispatcher';
3
import ObjectAttributes from './../../stores/ObjectAttributes';
4
import ObjectKeyModal from './ObjectKeyModal';
5

6
//global theme
7
import Theme from './../../themes/getStyle';
8

9
//this input appears when adding a new value to an object
10
export default class extends React.PureComponent {
11
    render() {
12
        const { active, theme, rjvId } = this.props;
10✔
13

14
        return active ? (
10✔
15
            <ObjectKeyModal
16
                rjvId={rjvId}
17
                theme={theme}
18
                isValid={this.isValid}
19
                submit={this.submit}
20
            />
21
        ) : null;
22
    }
23

24
    isValid = input => {
10✔
25
        const { rjvId } = this.props;
1✔
26
        const request = ObjectAttributes.get(
1✔
27
            rjvId,
28
            'action',
29
            'new-key-request'
30
        );
31
        return (
1✔
32
            input != '' &&
1!
33
            Object.keys(request.existing_value).indexOf(input) === -1
34
        );
35
    };
36

37
    submit = input => {
10✔
38
        const { rjvId } = this.props;
×
UNCOV
39
        let request = ObjectAttributes.get(rjvId, 'action', 'new-key-request');
×
40
        request.new_value = { ...request.existing_value };
×
41
        request.new_value[input] = this.props.defaultValue;
×
UNCOV
42
        dispatcher.dispatch({
×
43
            name: 'VARIABLE_ADDED',
44
            rjvId: rjvId,
45
            data: request
46
        });
47
    };
48
}
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