Skip to content

Commit

Permalink
Merge pull request #1960 from weaveworks/1325-close-help-dialog
Browse files Browse the repository at this point in the history
Close help dialog when the canvas is clicked
  • Loading branch information
jpellizzari authored Oct 28, 2016
2 parents 0d8152f + 52f7980 commit 654ba35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/app/scripts/reducers/__tests__/root-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,4 +463,9 @@ describe('RootReducer', () => {
expect(nextState.get('nodeDetails').size).toEqual(1);
expect(nextState.get('currentTopology').get('name')).toBe('Topo2');
});
it('closes the help dialog if the canvas is clicked', () => {
let nextState = initialState.set('showingHelp', true);
nextState = reducer(nextState, { type: ActionTypes.CLICK_BACKGROUND });
expect(nextState.get('showingHelp')).toBe(false);
});
});
3 changes: 3 additions & 0 deletions client/app/scripts/reducers/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ export function rootReducer(state = initialState, action) {
}

case ActionTypes.CLICK_BACKGROUND: {
if (state.get('showingHelp')) {
state = state.set('showingHelp', false);
}
return closeAllNodeDetails(state);
}

Expand Down

0 comments on commit 654ba35

Please sign in to comment.