lucid-ui
Version:
A UI component library from AppNexus.
36 lines • 1.01 kB
JavaScript
import assert from 'assert';
import { onSelect, onToggle } from './VerticalListMenu.reducers';
describe('VerticalListMenu reducers', function () {
describe('onSelect', function () {
it('should work with existing state', function () {
var initialState = {
selectedIndices: [100],
foo: 'asdf'
};
assert.deepEqual(onSelect(initialState, 20), {
selectedIndices: [20],
foo: 'asdf'
});
});
});
describe('onToggle', function () {
it('should remove items', function () {
var initialState = {
expandedIndices: [0, 1, 2, 3, 4],
bar: 'mert'
};
assert.deepEqual(onToggle(initialState, 2), {
expandedIndices: [0, 1, 3, 4],
bar: 'mert'
});
});
it('should add items', function () {
var initialState = {
expandedIndices: [0, 1, 2, 3, 4]
};
assert.deepEqual(onToggle(initialState, 99), {
expandedIndices: [0, 1, 2, 3, 4, 99]
});
});
});
});