A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
917 B
27 lines
917 B
7 years ago
|
import { expect } from "chai";
|
||
7 years ago
|
import actions from 'content/actions';
|
||
|
import inputReducer from 'content/reducers/input';
|
||
7 years ago
|
|
||
|
describe("input reducer", () => {
|
||
|
it('return the initial state', () => {
|
||
|
let state = inputReducer(undefined, {});
|
||
7 years ago
|
expect(state).to.have.deep.property('keys', '');
|
||
7 years ago
|
});
|
||
|
|
||
|
it('return next state for INPUT_KEY_PRESS', () => {
|
||
7 years ago
|
let action = { type: actions.INPUT_KEY_PRESS, key: 'a' };
|
||
7 years ago
|
let state = inputReducer(undefined, action);
|
||
7 years ago
|
expect(state).to.have.deep.property('keys', 'a');
|
||
7 years ago
|
|
||
7 years ago
|
action = { type: actions.INPUT_KEY_PRESS, key: '<C-B>' };
|
||
7 years ago
|
state = inputReducer(state, action);
|
||
7 years ago
|
expect(state).to.have.deep.property('keys', 'a<C-B>');
|
||
7 years ago
|
});
|
||
|
|
||
|
it('return next state for INPUT_CLEAR_KEYS', () => {
|
||
|
let action = { type: actions.INPUT_CLEAR_KEYS };
|
||
7 years ago
|
let state = inputReducer({ keys: 'abc' }, action);
|
||
|
expect(state).to.have.deep.property('keys', '');
|
||
7 years ago
|
});
|
||
|
});
|