mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-12 03:54:13 +00:00
bf6a122e38
* Initial changes to define theme maps, color function, and convert all global styles. * More global styles. * All styles converted, colors uncertain. * Fix tabs, temporary theme toggle button. * Color refinements * Color network selector, introduce shade function * Make palette page * Add theme button and minor styling to nav * Blueify dark theme * A bunch of color adjustments to work better with dark theme * Fix tables * Fix wallet decrypt colors * More misc fixes * Fix up electron colors * Convert web theme to redux state / action * Theme toggle in app, prevent rerenders * Get rid of all variables, fix selects * Fix conf modal, modal close styles * Fix test * Adjust swap colors * Check in breaking out component, changing icons * Check in progress * Theme toggle in footer. New icons * Prevent rerender on theme change * Fix up outstanding merge conflicts * Fix generate colors to be dark mode friendly * Reduce swap color intensity * Make disabled buttons darker in dark mode * Reduce button size by 25%
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
import {
|
|
changeLanguage,
|
|
setOnline,
|
|
setOffline,
|
|
toggleAutoGasLimit,
|
|
setLatestBlock
|
|
} from './actions';
|
|
import { metaReducer } from './reducer';
|
|
import { Theme } from 'config';
|
|
|
|
describe('meta reducer', () => {
|
|
const expectedInitialState = {
|
|
languageSelection: 'en',
|
|
offline: false,
|
|
autoGasLimit: true,
|
|
latestBlock: '???',
|
|
theme: Theme.LIGHT
|
|
};
|
|
|
|
const expectedState = {
|
|
initialState: expectedInitialState,
|
|
changingLanguage: {
|
|
...expectedInitialState,
|
|
languageSelection: 'langaugeToChange'
|
|
},
|
|
togglingToOffline: {
|
|
...expectedInitialState,
|
|
offline: true
|
|
},
|
|
togglingToOnline: {
|
|
...expectedInitialState,
|
|
offline: false
|
|
},
|
|
togglingToManualGasLimit: {
|
|
...expectedInitialState,
|
|
autoGasLimit: false
|
|
},
|
|
togglingToAutoGasLimit: {
|
|
...expectedInitialState,
|
|
autoGasLimit: true
|
|
},
|
|
settingLatestBlock: {
|
|
...expectedInitialState,
|
|
latestBlock: '12345'
|
|
}
|
|
};
|
|
|
|
const actions = {
|
|
changeLangauge: changeLanguage('langaugeToChange'),
|
|
setOnline: setOnline(),
|
|
setOffline: setOffline(),
|
|
toggleAutoGasLimit: toggleAutoGasLimit(),
|
|
setLatestBlock: setLatestBlock('12345')
|
|
};
|
|
it('should return the inital state', () =>
|
|
expect(metaReducer(undefined, {} as any)).toEqual(expectedState.initialState));
|
|
|
|
it('should handle toggling to offline', () =>
|
|
expect(metaReducer(expectedState.initialState, actions.setOffline)).toEqual(
|
|
expectedState.togglingToOffline
|
|
));
|
|
|
|
it('should handle toggling back to online', () =>
|
|
expect(metaReducer(expectedState.togglingToOffline, actions.setOnline)).toEqual(
|
|
expectedState.togglingToOnline
|
|
));
|
|
|
|
it('should handle toggling to manual gas limit', () =>
|
|
expect(metaReducer(expectedState.initialState, actions.toggleAutoGasLimit)).toEqual(
|
|
expectedState.togglingToManualGasLimit
|
|
));
|
|
|
|
it('should handle toggling back to auto gas limit', () =>
|
|
expect(metaReducer(expectedState.togglingToManualGasLimit, actions.toggleAutoGasLimit)).toEqual(
|
|
expectedState.togglingToAutoGasLimit
|
|
));
|
|
|
|
it('should handle setting the latest block', () =>
|
|
expect(metaReducer(expectedState.initialState, actions.setLatestBlock)).toEqual(
|
|
expectedState.settingLatestBlock
|
|
));
|
|
});
|