diff --git a/client/app/scripts/reducers/__tests__/root-test.js b/client/app/scripts/reducers/__tests__/root-test.js index f25701e0f..7f788187a 100644 --- a/client/app/scripts/reducers/__tests__/root-test.js +++ b/client/app/scripts/reducers/__tests__/root-test.js @@ -540,4 +540,15 @@ describe('RootReducer', () => { expect(nextState.get('selectedNodeId')).toBeFalsy(); expect(nextState.getIn(['nodeDetails', 'n1'])).toBeFalsy(); }); + it('highlights bidirectional edges', () => { + const action = { + type: ActionTypes.ENTER_EDGE, + edgeId: 'abc123-def456' + }; + const nextState = reducer(initialState, action); + expect(nextState.get('highlightedEdgeIds').toJS()).toEqual([ + 'abc123-def456', + 'def456-abc123' + ]); + }); }); diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index bc1ad432f..49fe78d12 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -421,7 +421,10 @@ export function rootReducer(state = initialState, action) { // highlight edge state = state.update('highlightedEdgeIds', (highlightedEdgeIds) => { highlightedEdgeIds = highlightedEdgeIds.clear(); - return highlightedEdgeIds.add(action.edgeId); + highlightedEdgeIds = highlightedEdgeIds.add(action.edgeId); + const opposite = action.edgeId.split(EDGE_ID_SEPARATOR).reverse().join(EDGE_ID_SEPARATOR); + highlightedEdgeIds = highlightedEdgeIds.add(opposite); + return highlightedEdgeIds; }); return state; diff --git a/client/app/scripts/utils/__tests__/layouter-utils-test.js b/client/app/scripts/utils/__tests__/layouter-utils-test.js index f5d36ee23..7b0659929 100644 --- a/client/app/scripts/utils/__tests__/layouter-utils-test.js +++ b/client/app/scripts/utils/__tests__/layouter-utils-test.js @@ -1,7 +1,7 @@ import { fromJS } from 'immutable'; import { - initEdgesFromNodes, + initEdgesFromNodes } from '../layouter-utils';