All files / components/VerticalListMenu VerticalListMenu.reducers.js

100% Statements 3/3
25% Branches 1/4
100% Functions 2/2
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18      1x             2x   2x          
import _ from 'lodash';
 
export function onSelect(state = {}, index) {
	return {
		...state,
		selectedIndices: [index],
	}
}
 
export function onToggle(state = {}, index) {
	const expandedIndices = state.expandedIndices || [];
 
	return {
		...state,
		expandedIndices: _.xor(expandedIndices, [index]),
	}
}