diff options
author | Matthew Shao <me@matshao.com> | 2017-07-20 22:26:28 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-07-20 22:26:28 +0800 |
commit | cb73658dd43e01bdedd84aa31601887b19c106ca (patch) | |
tree | f557ba665efeb7ba27f0b9f0523b374ded8dbb4c /web/src/js | |
parent | f465f08c9ac302007b3aec6709a8e82d63c7ad65 (diff) | |
download | mitmproxy-cb73658dd43e01bdedd84aa31601887b19c106ca.tar.gz mitmproxy-cb73658dd43e01bdedd84aa31601887b19c106ca.tar.bz2 mitmproxy-cb73658dd43e01bdedd84aa31601887b19c106ca.zip |
[web] Remove js/ducks/ui/option.js
Diffstat (limited to 'web/src/js')
-rw-r--r-- | web/src/js/__tests__/ducks/ui/optionSpec.js | 39 | ||||
-rw-r--r-- | web/src/js/ducks/ui/option.js | 39 |
2 files changed, 0 insertions, 78 deletions
diff --git a/web/src/js/__tests__/ducks/ui/optionSpec.js b/web/src/js/__tests__/ducks/ui/optionSpec.js deleted file mode 100644 index 4b6b43cc..00000000 --- a/web/src/js/__tests__/ducks/ui/optionSpec.js +++ /dev/null @@ -1,39 +0,0 @@ -import reduceOption, * as optionActions from '../../../ducks/ui/option' - -describe('option reducer', () => { - - it('should return the initial state', () => { - expect(reduceOption(undefined, {})).toEqual({}) - }) - - let state = undefined - it('should handle option update start', () => { - state = reduceOption(undefined, { - type: optionActions.OPTION_UPDATE_START, option: 'foo', value: 'bar' - }) - expect(state).toEqual({ - foo: { - error: false, - isUpdating: true, - value: 'bar' - } - }) - }) - - it('should handle option update success', () => { - expect(reduceOption(state, { - type: optionActions.OPTION_UPDATE_SUCCESS, option: 'foo' - })).toEqual({}) - }) - - it('should handle option update error', () => { - expect(reduceOption(undefined, { - type: optionActions.OPTION_UPDATE_ERROR, option: 'foo', error: 'errorMsg' - })).toEqual({ - foo: { - error: 'errorMsg', - isUpdating: false, - } - }) - }) -}) diff --git a/web/src/js/ducks/ui/option.js b/web/src/js/ducks/ui/option.js deleted file mode 100644 index a58fde4c..00000000 --- a/web/src/js/ducks/ui/option.js +++ /dev/null @@ -1,39 +0,0 @@ -export const OPTION_UPDATE_START = 'UI_OPTION_UPDATE_START' -export const OPTION_UPDATE_SUCCESS = 'UI_OPTION_UPDATE_SUCCESS' -export const OPTION_UPDATE_ERROR = 'UI_OPTION_UPDATE_ERROR' - -const defaultState = { - /* optionName -> {isUpdating, value (client-side), error} */ -} - -export default function reducer(state = defaultState, action) { - switch (action.type) { - case OPTION_UPDATE_START: - return { - ...state, - [action.option]: { - isUpdating: true, - value: action.value, - error: false, - } - } - - case OPTION_UPDATE_SUCCESS: - let s = {...state} - delete s[action.option] - return s - - case OPTION_UPDATE_ERROR: - return { - ...state, - [action.option]: { - ...state[action.option], - isUpdating: false, - error: action.error - } - } - - default: - return state - } -} |