From 52f7980f6f4c0582d41326ed42eb573beca4d616 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Thu, 27 Oct 2016 18:04:38 -0700 Subject: [PATCH] Added logic to close help dialog when canvas is clicked --- client/app/scripts/reducers/__tests__/root-test.js | 5 +++++ client/app/scripts/reducers/root.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/client/app/scripts/reducers/__tests__/root-test.js b/client/app/scripts/reducers/__tests__/root-test.js index c7238471bc..21b346f87c 100644 --- a/client/app/scripts/reducers/__tests__/root-test.js +++ b/client/app/scripts/reducers/__tests__/root-test.js @@ -471,4 +471,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); + }); }); diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 13f60fb4bf..3cb427f920 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -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); }