lucid-ui
Version:
A UI component library from AppNexus.
29 lines • 1.07 kB
JavaScript
import assert from 'assert';
import { onDragStart, onDragEnd, onDragOver } from './DraggableList.reducers';
describe('DraggableList reducers', function () {
describe('onDragStart', function () {
it('should set the dragIndex`', function () {
var nextState = onDragStart({}, 2);
assert.equal(nextState.dragIndex, 2, 'must update the dragIndex');
});
});
describe('onDragOver', function () {
it('should set the dragOverIndex`', function () {
var nextState = onDragOver({
dragIndex: 0
}, 3);
assert.equal(nextState.dragIndex, 0, 'must update the dragIndex');
assert.equal(nextState.dragOverIndex, 3, 'must update the dragOverIndex');
});
});
describe('onDragEnd', function () {
it('should set the dragOverIndex`', function () {
var nextState = onDragEnd({
dragIndex: 0,
dragOverIndex: 2
});
assert.equal(nextState.dragIndex, undefined, 'must clear the dragIndex');
assert.equal(nextState.dragOverIndex, undefined, 'must clear the dragOverIndex');
});
});
});