aboutsummaryrefslogtreecommitdiff
path: root/test/console/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-02-25 22:04:12 +0900
committerGitHub <noreply@github.com>2019-02-25 22:04:12 +0900
commit124e221999e914d63326a91602517d1e5e1bea73 (patch)
tree99184620375b5608c31b58f14d74cb450f7f4224 /test/console/reducers
parentcebd64a69f705482957a5e6a3f23054ca7985aa4 (diff)
parent9868da1ac479ee75a4abe8142a9b406a18b5ac52 (diff)
Merge pull request #538 from ueokande/scroll-console
Scroll console
Diffstat (limited to 'test/console/reducers')
-rw-r--r--test/console/reducers/console.test.js38
1 files changed, 15 insertions, 23 deletions
diff --git a/test/console/reducers/console.test.js b/test/console/reducers/console.test.js
index db40088..d5a38cf 100644
--- a/test/console/reducers/console.test.js
+++ b/test/console/reducers/console.test.js
@@ -8,8 +8,7 @@ describe("console reducer", () => {
expect(state).to.have.property('messageText', '');
expect(state).to.have.property('consoleText', '');
expect(state).to.have.deep.property('completions', []);
- expect(state).to.have.property('groupSelection', -1);
- expect(state).to.have.property('itemSelection', -1);
+ expect(state).to.have.property('select', -1);
});
it('return next state for CONSOLE_HIDE', () => {
@@ -60,8 +59,7 @@ describe("console reducer", () => {
it ('return next state for CONSOLE_SET_COMPLETIONS', () => {
let state = {
- groupSelection: 0,
- itemSelection: 0,
+ select: 0,
completions: [],
}
let action = {
@@ -76,15 +74,13 @@ describe("console reducer", () => {
}
state = reducer(state, action);
expect(state).to.have.property('completions', action.completions);
- expect(state).to.have.property('groupSelection', -1);
- expect(state).to.have.property('itemSelection', -1);
+ expect(state).to.have.property('select', -1);
});
it ('return next state for CONSOLE_COMPLETION_NEXT', () => {
let action = { type: actions.CONSOLE_COMPLETION_NEXT };
let state = {
- groupSelection: -1,
- itemSelection: -1,
+ select: -1,
completions: [{
name: 'Apple',
items: [1, 2]
@@ -95,24 +91,22 @@ describe("console reducer", () => {
};
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', 0);
- expect(state).to.have.property('itemSelection', 0);
+ expect(state).to.have.property('select', 0);
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', 0);
- expect(state).to.have.property('itemSelection', 1);
+ expect(state).to.have.property('select', 1);
state = reducer(state, action);
+ expect(state).to.have.property('select', 2);
+
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', -1);
- expect(state).to.have.property('itemSelection', -1);
+ expect(state).to.have.property('select', -1);
});
it ('return next state for CONSOLE_COMPLETION_PREV', () => {
let action = { type: actions.CONSOLE_COMPLETION_PREV };
let state = {
- groupSelection: -1,
- itemSelection: -1,
+ select: -1,
completions: [{
name: 'Apple',
items: [1, 2]
@@ -123,17 +117,15 @@ describe("console reducer", () => {
};
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', 1);
- expect(state).to.have.property('itemSelection', 0);
+ expect(state).to.have.property('select', 2);
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', 0);
- expect(state).to.have.property('itemSelection', 1);
+ expect(state).to.have.property('select', 1);
state = reducer(state, action);
+ expect(state).to.have.property('select', 0);
+
state = reducer(state, action);
- expect(state).to.have.property('groupSelection', -1);
- expect(state).to.have.property('itemSelection', -1);
+ expect(state).to.have.property('select', -1);
});
-
});