Skip to content

Commit c6399e4

Browse files
committed
update layer_control jest test
1 parent 982ec5e commit c6399e4

3 files changed

Lines changed: 128 additions & 3 deletions

File tree

x-pack/legacy/plugins/maps/public/connected_components/map_settings_panel/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { AnyAction, Dispatch } from 'redux';
88
import { connect } from 'react-redux';
99
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
1010
import { FLYOUT_STATE } from '../../../../../../plugins/maps/public/reducers/ui';
11+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
12+
import { MapStoreState } from '../../../../../../plugins/maps/public/reducers/store';
1113
import { MapSettingsPanel } from './map_settings_panel';
1214
import { rollbackMapSettings, updateMapSetting } from '../../actions/map_actions';
1315
import { getMapSettings, hasMapSettingsChanges } from '../../selectors/map_selectors';
1416
import { updateFlyout } from '../../actions/ui_actions';
1517

16-
function mapStateToProps(state) {
18+
function mapStateToProps(state: MapStoreState) {
1719
return {
1820
settings: getMapSettings(state),
1921
hasMapSettingsChanges: hasMapSettingsChanges(state),
@@ -29,7 +31,7 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>) {
2931
keepChanges: () => {
3032
dispatch(updateFlyout(FLYOUT_STATE.NONE));
3133
},
32-
updateMapSetting: (settingKey: string, settingValue: string) => {
34+
updateMapSetting: (settingKey: string, settingValue: string | number | boolean) => {
3335
dispatch(updateMapSetting(settingKey, settingValue));
3436
},
3537
};

x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/__snapshots__/view.test.js.snap

Lines changed: 116 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/view.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const defaultProps = {
1919
showAddLayerWizard: () => {},
2020
closeLayerTOC: () => {},
2121
openLayerTOC: () => {},
22+
openMapSettings: () => {},
2223
isLayerTOCOpen: true,
2324
layerList: [],
25+
isFlyoutOpen: false,
2426
};
2527

2628
describe('LayerControl', () => {
@@ -30,6 +32,12 @@ describe('LayerControl', () => {
3032
expect(component).toMatchSnapshot();
3133
});
3234

35+
test('should disable buttons when flyout is open', () => {
36+
const component = shallow(<LayerControl {...defaultProps} isFlyoutOpen={true} />);
37+
38+
expect(component).toMatchSnapshot();
39+
});
40+
3341
test('isReadOnly', () => {
3442
const component = shallow(<LayerControl {...defaultProps} isReadOnly={true} />);
3543

0 commit comments

Comments
 (0)