Skip to content

Commit

Permalink
update layer_control jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Apr 16, 2020
1 parent 982ec5e commit c6399e4
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { AnyAction, Dispatch } from 'redux';
import { connect } from 'react-redux';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE } from '../../../../../../plugins/maps/public/reducers/ui';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MapStoreState } from '../../../../../../plugins/maps/public/reducers/store';
import { MapSettingsPanel } from './map_settings_panel';
import { rollbackMapSettings, updateMapSetting } from '../../actions/map_actions';
import { getMapSettings, hasMapSettingsChanges } from '../../selectors/map_selectors';
import { updateFlyout } from '../../actions/ui_actions';

function mapStateToProps(state) {
function mapStateToProps(state: MapStoreState) {
return {
settings: getMapSettings(state),
hasMapSettingsChanges: hasMapSettingsChanges(state),
Expand All @@ -29,7 +31,7 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>) {
keepChanges: () => {
dispatch(updateFlyout(FLYOUT_STATE.NONE));
},
updateMapSetting: (settingKey: string, settingValue: string) => {
updateMapSetting: (settingKey: string, settingValue: string | number | boolean) => {
dispatch(updateMapSetting(settingKey, settingValue));
},
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const defaultProps = {
showAddLayerWizard: () => {},
closeLayerTOC: () => {},
openLayerTOC: () => {},
openMapSettings: () => {},
isLayerTOCOpen: true,
layerList: [],
isFlyoutOpen: false,
};

describe('LayerControl', () => {
Expand All @@ -30,6 +32,12 @@ describe('LayerControl', () => {
expect(component).toMatchSnapshot();
});

test('should disable buttons when flyout is open', () => {
const component = shallow(<LayerControl {...defaultProps} isFlyoutOpen={true} />);

expect(component).toMatchSnapshot();
});

test('isReadOnly', () => {
const component = shallow(<LayerControl {...defaultProps} isReadOnly={true} />);

Expand Down

0 comments on commit c6399e4

Please sign in to comment.