Merge pull request #150 from ueokande/qa-0.5

QA 0.5
jh-changes
Shin'ya Ueoka 7 years ago committed by GitHub
commit 44bbadde3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      QA.md
  2. 7
      src/content/actions/setting.js
  3. 2
      src/content/components/common/keymapper.js
  4. 3
      src/content/reducers/setting.js
  5. 4
      src/content/scrolls.js
  6. 4
      test/content/actions/setting.test.js

14
QA.md

@ -27,8 +27,11 @@ The behaviors of the console are tested in [Console section](#consoles).
- [ ] <kbd>d</kbd>: delete current tab - [ ] <kbd>d</kbd>: delete current tab
- [ ] <kbd>u</kbd>: reopen close tab - [ ] <kbd>u</kbd>: reopen close tab
- [ ] <kbd>K</kbd>, <kbd>J</kbd>: select prev and next tab - [ ] <kbd>K</kbd>, <kbd>J</kbd>: select prev and next tab
- [ ] <kbd>g0</kbd>, <kbd>g$</kbd>: select first and last tab
- [ ] <kbd>r</kbd>: reload current tab - [ ] <kbd>r</kbd>: reload current tab
- [ ] <kbd>R</kbd>: reload current tab without cache - [ ] <kbd>R</kbd>: reload current tab without cache
- [ ] <kbd>zd</kbd>: duplicate current tab
- [ ] <kbd>zp</kbd>: toggle pin/unpin state on current tab
#### Navigation #### Navigation
@ -141,6 +144,17 @@ The behaviors of the console are tested in [Console section](#consoles).
- [ ] Fucus text box on Twitter or Slack, press <kbd>j</kbd>, then <kbd>j</kbd> is typed in the box - [ ] Fucus text box on Twitter or Slack, press <kbd>j</kbd>, then <kbd>j</kbd> is typed in the box
- [ ] Focus the text box on Twitter or Slack on following mode - [ ] Focus the text box on Twitter or Slack on following mode
## Find mode
- [ ] open console with <kbd>/</kbd>
- [ ] highlight a word on <kbd>Enter</kb> pressed in find console
- [ ] Search next/prev by <kbd>n</kbd>/<kbd>N</kbd>
- [ ] Wrap search by <kbd>n</kbd>/<kbd>N</kbd>
- [ ] Find with last keyword if keyword is empty
## Misc ## Misc
- [ ] Work after plugin reload - [ ] Work after plugin reload
- [ ] Work on `about:blank`
- [ ] Able to map `<A-Z>` key.
- [ ] Open file menu by <kbd>Alt</kbd>+<kbd>F</kbd> (Other than Mac OS)

@ -2,21 +2,20 @@ import actions from 'content/actions';
import * as keyUtils from 'shared/utils/keys'; import * as keyUtils from 'shared/utils/keys';
const set = (value) => { const set = (value) => {
let maps = new Map(); let entries = [];
if (value.keymaps) { if (value.keymaps) {
let entries = Object.entries(value.keymaps).map((entry) => { entries = Object.entries(value.keymaps).map((entry) => {
return [ return [
keyUtils.fromMapKeys(entry[0]), keyUtils.fromMapKeys(entry[0]),
entry[1], entry[1],
]; ];
}); });
maps = new Map(entries);
} }
return { return {
type: actions.SETTING_SET, type: actions.SETTING_SET,
value: Object.assign({}, value, { value: Object.assign({}, value, {
keymaps: maps, keymaps: entries,
}) })
}; };
}; };

@ -25,7 +25,7 @@ export default class KeymapperComponent {
let state = this.store.getState(); let state = this.store.getState();
let input = state.input; let input = state.input;
let keymaps = state.setting.keymaps; let keymaps = new Map(state.setting.keymaps);
let matched = Array.from(keymaps.keys()).filter((mapping) => { let matched = Array.from(keymaps.keys()).filter((mapping) => {
return mapStartsWith(mapping, input.keys); return mapStartsWith(mapping, input.keys);

@ -1,7 +1,8 @@
import actions from 'content/actions'; import actions from 'content/actions';
const defaultState = { const defaultState = {
keymaps: new Map(), // keymaps is and arrays of key-binding pairs, which is entries of Map
keymaps: [],
}; };
export default function reducer(state = defaultState, action = {}) { export default function reducer(state = defaultState, action = {}) {

@ -104,14 +104,14 @@ const scrollBottom = (win) => {
const scrollHome = (win) => { const scrollHome = (win) => {
let target = scrollTarget(win); let target = scrollTarget(win);
let x = 0; let x = 0;
let y = target.scrollLeft; let y = target.scrollTop;
target.scrollTo(x, y); target.scrollTo(x, y);
}; };
const scrollEnd = (win) => { const scrollEnd = (win) => {
let target = scrollTarget(win); let target = scrollTarget(win);
let x = target.scrollWidth; let x = target.scrollWidth;
let y = target.scrollLeft; let y = target.scrollTop;
target.scrollTo(x, y); target.scrollTo(x, y);
}; };

@ -20,8 +20,8 @@ describe("setting actions", () => {
} }
}); });
let keymaps = action.value.keymaps; let keymaps = action.value.keymaps;
let map = new Map(keymaps);
expect(action.value.keymaps).to.have.deep.all.keys( expect(map).to.have.deep.all.keys(
[ [
[{ key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }, [{ key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
{ key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }], { key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }],