Commit 7c763a5b authored by Phil Hughes's avatar Phil Hughes

Fix showBlobInteractionZones throwing an error when no data exists

parent 839037bf
......@@ -30,7 +30,9 @@ export default {
});
},
showBlobInteractionZones({ state }, path) {
Object.values(state.data[path]).forEach(d => addInteractionClass(path, d));
if (state.data && state.data[path]) {
Object.values(state.data[path]).forEach(d => addInteractionClass(path, d));
}
},
showDefinition({ commit, state }, { target: el }) {
let definition;
......
......@@ -143,6 +143,16 @@ describe('Code navigation actions', () => {
expect(addInteractionClass.mock.calls[0]).toEqual(['index.js', 'test']);
expect(addInteractionClass.mock.calls[1]).toEqual(['index.js', 'console.log']);
});
it('does not call addInteractionClass when no data exists', () => {
const state = {
data: null,
};
actions.showBlobInteractionZones({ state }, 'index.js');
expect(addInteractionClass).not.toHaveBeenCalled();
});
});
describe('showDefinition', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment