Commit ecae140f authored by Thomas Randolph's avatar Thomas Randolph

Add mutation to change fileByFile setting

parent 79166d64
......@@ -28,6 +28,7 @@ export const SET_HIGHLIGHTED_ROW = 'SET_HIGHLIGHTED_ROW';
export const SET_TREE_DATA = 'SET_TREE_DATA';
export const SET_RENDER_TREE_LIST = 'SET_RENDER_TREE_LIST';
export const SET_SHOW_WHITESPACE = 'SET_SHOW_WHITESPACE';
export const SET_FILE_BY_FILE = 'SET_FILE_BY_FILE';
export const TOGGLE_FILE_FINDER_VISIBLE = 'TOGGLE_FILE_FINDER_VISIBLE';
export const REQUEST_FULL_DIFF = 'REQUEST_FULL_DIFF';
......
......@@ -36,6 +36,7 @@ export default {
projectPath,
dismissEndpoint,
showSuggestPopover,
viewDiffsFileByFile,
} = options;
Object.assign(state, {
endpoint,
......@@ -45,6 +46,7 @@ export default {
projectPath,
dismissEndpoint,
showSuggestPopover,
viewDiffsFileByFile,
});
},
......@@ -352,4 +354,7 @@ export default {
[types.SET_SHOW_SUGGEST_POPOVER](state) {
state.showSuggestPopover = false;
},
[types.SET_FILE_BY_FILE](state, fileByFile) {
state.viewDiffsFileByFile = fileByFile;
},
};
......@@ -892,4 +892,18 @@ describe('DiffsStoreMutations', () => {
expect(state.showSuggestPopover).toBe(false);
});
});
describe('SET_FILE_BY_FILE', () => {
it.each`
value | opposite
${true} | ${false}
${false} | ${true}
`('sets viewDiffsFileByFile to $value', ({ value, opposite }) => {
const state = { viewDiffsFileByFile: opposite };
mutations[types.SET_FILE_BY_FILE](state, value);
expect(state.viewDiffsFileByFile).toBe(value);
});
});
});
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