Skip to content

Commit

Permalink
Experimentally revert changes around Layercontrol
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed May 22, 2024
1 parent af303f4 commit 227b375
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.

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 @@ -20,7 +20,7 @@ jest.mock('../../../kibana_services', () => ({
import React from 'react';
import { shallow } from 'enzyme';

import { LayerControlInternal } from './layer_control';
import { LayerControl } from './layer_control';
import { ILayer } from '../../../classes/layers/layer';

const defaultProps = {
Expand All @@ -36,34 +36,34 @@ const defaultProps = {
zoom: 0,
};

describe('LayerControlInternal', () => {
describe('LayerControl', () => {
test('is rendered', () => {
const component = shallow(<LayerControlInternal {...defaultProps} />);
const component = shallow(<LayerControl {...defaultProps} />);

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

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

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

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

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

describe('isLayerTOCOpen', () => {
test('Should render expand button', () => {
const component = shallow(<LayerControlInternal {...defaultProps} isLayerTOCOpen={false} />);
const component = shallow(<LayerControl {...defaultProps} isLayerTOCOpen={false} />);
expect(component).toMatchSnapshot();
});

test('Should render expand button with loading icon when layer is loading', () => {
const component = shallow(
<LayerControlInternal
<LayerControl
{...defaultProps}
isLayerTOCOpen={false}
layerList={[
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('LayerControlInternal', () => {
},
} as unknown as ILayer;
const component = shallow(
<LayerControlInternal
<LayerControl
{...defaultProps}
isLayerTOCOpen={false}
layerList={[mockLayerThatHasError]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { LayerTOC } from './layer_toc';
import { getAnalytics, getCoreI18n, getTheme, isScreenshotMode } from '../../../kibana_services';
import { isScreenshotMode } from '../../../kibana_services';
import { ILayer } from '../../../classes/layers/layer';
import { ExpandButton } from './expand_button';

Expand All @@ -37,7 +36,7 @@ export interface Props {
zoom: number;
}

export function LayerControlInternal({
export function LayerControl({
isReadOnly,
isLayerTOCOpen,
showAddLayerWizard,
Expand Down Expand Up @@ -191,11 +190,3 @@ export function LayerControlInternal({
</Fragment>
);
}

export function LayerControl(props: Props) {
return (
<KibanaRenderContextProvider analytics={getAnalytics()} i18n={getCoreI18n()} theme={getTheme()}>
<LayerControlInternal {...props} />
</KibanaRenderContextProvider>
);
}

0 comments on commit 227b375

Please sign in to comment.