diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c9152b..2e7908a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- Add description tooltips for node and edge types in the weight configuration UI (#1081) - Add the `export-graph` command (#1110) - Enable loading private repositories (#1085) - Enable setting type weights to 0 in the UI (#1005) diff --git a/src/explorer/weights/EdgeTypeConfig.js b/src/explorer/weights/EdgeTypeConfig.js index 1490afb..c2d36b4 100644 --- a/src/explorer/weights/EdgeTypeConfig.js +++ b/src/explorer/weights/EdgeTypeConfig.js @@ -15,6 +15,7 @@ export class EdgeTypeConfig extends React.Component<{ { this.props.onChange({ ...this.props.weightedType, @@ -25,6 +26,7 @@ export class EdgeTypeConfig extends React.Component<{ { this.props.onChange({ ...this.props.weightedType, @@ -57,6 +59,7 @@ export class EdgeWeightSlider extends React.Component { ); diff --git a/src/explorer/weights/EdgeTypeConfig.test.js b/src/explorer/weights/EdgeTypeConfig.test.js index f9e5401..ee9f5ae 100644 --- a/src/explorer/weights/EdgeTypeConfig.test.js +++ b/src/explorer/weights/EdgeTypeConfig.test.js @@ -35,6 +35,12 @@ describe("explorer/weights/EdgeTypeConfig", () => { expect(backwardSlider.props().name).toBe(assemblesEdgeType.forwardName); expect(backwardSlider.props().weight).toBe(wet.backwardWeight); }); + it("has a description", () => { + const {backwardSlider} = example(); + expect(backwardSlider.props().description).toBe( + assemblesEdgeType.description + ); + }); it("forward weight slider onChange works", () => { const {wet, forwardSlider, onChange} = example(); forwardSlider.props().onChange(9); @@ -54,7 +60,12 @@ describe("explorer/weights/EdgeTypeConfig", () => { function example() { const onChange = jest.fn(); const element = shallow( - + ); const weightSlider = element.find(WeightSlider); return {element, onChange, weightSlider}; diff --git a/src/explorer/weights/NodeTypeConfig.js b/src/explorer/weights/NodeTypeConfig.js index 4ebba5c..3571799 100644 --- a/src/explorer/weights/NodeTypeConfig.js +++ b/src/explorer/weights/NodeTypeConfig.js @@ -13,6 +13,7 @@ export class NodeTypeConfig extends React.Component<{ { this.props.onChange({ ...this.props.weightedType, diff --git a/src/explorer/weights/NodeTypeConfig.test.js b/src/explorer/weights/NodeTypeConfig.test.js index f288f61..ef3f3a7 100644 --- a/src/explorer/weights/NodeTypeConfig.test.js +++ b/src/explorer/weights/NodeTypeConfig.test.js @@ -28,6 +28,10 @@ describe("explorer/weights/NodeTypeConfig", () => { expect(slider.props().name).toBe(wnt.type.name); expect(slider.props().weight).toBe(wnt.weight); }); + it("has a description", () => { + const {wnt, slider} = example(); + expect(slider.props().description).toBe(wnt.type.description); + }); it("weight slider onChange works", () => { const {wnt, slider, onChange} = example(); slider.props().onChange(9); diff --git a/src/explorer/weights/WeightSlider.js b/src/explorer/weights/WeightSlider.js index 80921f8..a71d368 100644 --- a/src/explorer/weights/WeightSlider.js +++ b/src/explorer/weights/WeightSlider.js @@ -28,6 +28,7 @@ export type Props = {| +name: React$Node, // Callback invoked with the new weight after the user adjusts the slider. +onChange: (Weight) => void, + +description: string, |}; /** @@ -54,7 +55,7 @@ export type Props = {| export class WeightSlider extends React.Component { render() { return ( -