diff --git a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/__snapshots__/layer_template.test.tsx.snap b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/__snapshots__/layer_template.test.tsx.snap
new file mode 100644
index 00000000000000..fca33effee7299
--- /dev/null
+++ b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/__snapshots__/layer_template.test.tsx.snap
@@ -0,0 +1,107 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render EMS UI when left source is BOUNDARIES_SOURCE.EMS 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`should render elasticsearch UI when left source is BOUNDARIES_SOURCE.ELASTICSEARCH 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts
index bc69b0b5c59d97..61fb6ef54c2073 100644
--- a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts
+++ b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts
@@ -134,6 +134,7 @@ export function createEsChoroplethLayerDescriptor({
geoField: leftGeoField,
scalingType: SCALING_TYPES.LIMIT,
tooltipProperties: [leftJoinField],
+ applyGlobalQuery: false,
}),
leftField: leftJoinField,
rightIndexPatternId,
diff --git a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx
new file mode 100644
index 00000000000000..e9d25320712036
--- /dev/null
+++ b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+jest.mock('../../../kibana_services', () => {
+ const MockIndexPatternSelect = (props: unknown) => {
+ return
;
+ };
+ return {
+ getIndexPatternSelectComponent: () => {
+ return MockIndexPatternSelect;
+ },
+ };
+});
+
+import React from 'react';
+import { shallow } from 'enzyme';
+import { BOUNDARIES_SOURCE, LayerTemplate } from './layer_template';
+
+const renderWizardArguments = {
+ previewLayers: () => {},
+ mapColors: [],
+ isIndexingTriggered: false,
+ onRemove: () => {},
+ onIndexReady: () => {},
+ importSuccessHandler: () => {},
+ importErrorHandler: () => {},
+};
+
+test('should render elasticsearch UI when left source is BOUNDARIES_SOURCE.ELASTICSEARCH', async () => {
+ const component = shallow();
+ component.setState({ leftSource: BOUNDARIES_SOURCE.ELASTICSEARCH });
+ expect(component).toMatchSnapshot();
+});
+
+test('should render EMS UI when left source is BOUNDARIES_SOURCE.EMS', async () => {
+ const component = shallow();
+ component.setState({ leftSource: BOUNDARIES_SOURCE.EMS });
+ expect(component).toMatchSnapshot();
+});
diff --git a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.tsx b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.tsx
index c10d0c57832f87..e6e8c3612f9ceb 100644
--- a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.tsx
+++ b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.tsx
@@ -123,19 +123,24 @@ export class LayerTemplate extends Component {
return;
}
- const fields = emsFileLayer.getFieldsInLanguage();
- this.setState({
- leftEmsFields: fields
- .filter((field) => {
- return field.type === 'id';
- })
- .map((field) => {
- return {
- value: field.name,
- label: field.description,
- };
- }),
- });
+ const leftEmsFields = emsFileLayer
+ .getFieldsInLanguage()
+ .filter((field) => {
+ return field.type === 'id';
+ })
+ .map((field) => {
+ return {
+ value: field.name,
+ label: field.description,
+ };
+ });
+ this.setState(
+ {
+ leftEmsFields,
+ leftJoinField: leftEmsFields.length ? leftEmsFields[0].value : null,
+ },
+ this._previewLayer
+ );
};
_onLeftSourceChange = (optionId: string) => {
diff --git a/x-pack/plugins/maps/public/components/__snapshots__/geo_index_pattern_select.test.tsx.snap b/x-pack/plugins/maps/public/components/__snapshots__/geo_index_pattern_select.test.tsx.snap
new file mode 100644
index 00000000000000..809fe618625130
--- /dev/null
+++ b/x-pack/plugins/maps/public/components/__snapshots__/geo_index_pattern_select.test.tsx.snap
@@ -0,0 +1,104 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render 1`] = `
+
+
+
+
+
+`;
+
+exports[`should render no index pattern warning when there are no matching index patterns 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/x-pack/plugins/maps/public/components/geo_index_pattern_select.test.tsx b/x-pack/plugins/maps/public/components/geo_index_pattern_select.test.tsx
new file mode 100644
index 00000000000000..74d29e7d7e59a8
--- /dev/null
+++ b/x-pack/plugins/maps/public/components/geo_index_pattern_select.test.tsx
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+jest.mock('../kibana_services', () => {
+ const MockIndexPatternSelect = (props: unknown) => {
+ return ;
+ };
+ const MockHttp = {
+ basePath: {
+ prepend: (path: string) => {
+ return `abc/${path}`;
+ },
+ },
+ };
+ return {
+ getIndexPatternSelectComponent: () => {
+ return MockIndexPatternSelect;
+ },
+ getHttp: () => {
+ return MockHttp;
+ },
+ };
+});
+
+import React from 'react';
+import { shallow } from 'enzyme';
+import { GeoIndexPatternSelect } from './geo_index_pattern_select';
+
+test('should render', async () => {
+ const component = shallow( {}} value={'indexPatternId'} />);
+
+ expect(component).toMatchSnapshot();
+});
+
+test('should render no index pattern warning when there are no matching index patterns', async () => {
+ const component = shallow( {}} value={'indexPatternId'} />);
+ component.setState({ noGeoIndexPatternsExist: true });
+ expect(component).toMatchSnapshot();
+});