Skip to content

Commit

Permalink
i18n fixes and fix GeometryFilterForm jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed May 26, 2021
1 parent 6311dab commit 61c1e56
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 289 deletions.

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

68 changes: 3 additions & 65 deletions x-pack/plugins/maps/public/components/geometry_filter_form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,76 +16,14 @@ const defaultProps = {
onSubmit: () => {},
};

test('should render relation select without "within"-relation when geo field is geo_point', async () => {
const component = shallow(
<GeometryFilterForm
{...defaultProps}
geoFields={[
{
geoFieldName: 'my geo field',
geoFieldType: 'geo_point',
indexPatternTitle: 'My index',
indexPatternId: 1,
},
]}
/>
);

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

test('should render relation select when geo field is geo_shape', async () => {
const component = shallow(
<GeometryFilterForm
{...defaultProps}
geoFields={[
{
geoFieldName: 'my geo field',
geoFieldType: 'geo_shape',
indexPatternTitle: 'My index',
indexPatternId: 1,
},
]}
/>
);

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

test('should not show "within" relation when filter geometry is not closed', async () => {
const component = shallow(
<GeometryFilterForm
{...defaultProps}
geoFields={[
{
geoFieldName: 'my geo field',
geoFieldType: 'geo_shape',
indexPatternTitle: 'My index',
indexPatternId: 1,
},
]}
isFilterGeometryClosed={false}
/>
);
test('render', async () => {
const component = shallow(<GeometryFilterForm {...defaultProps} />);

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

test('should render error message', async () => {
const component = shallow(
<GeometryFilterForm
{...defaultProps}
geoFields={[
{
geoFieldName: 'my geo field',
geoFieldType: 'geo_point',
indexPatternTitle: 'My index',
indexPatternId: 1,
},
]}
errorMsg="Simulated error"
/>
);
const component = shallow(<GeometryFilterForm {...defaultProps} errorMsg="Simulated error" />);

expect(component).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class TooltipControl extends Component<Props, {}> {
const isPolygon =
geometry &&
(geometry.type === GEO_JSON_TYPE.POLYGON || geometry.type === GEO_JSON_TYPE.MULTI_POLYGON);
if (isPolygon && this.props.addFilters) {
if (isPolygon && this.props.geoFieldNames.length && this.props.addFilters) {
actions.push({
label: i18n.translate('xpack.maps.tooltip.action.filterByGeometryLabel', {
defaultMessage: 'Filter by geometry',
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -13613,7 +13613,6 @@
"xpack.maps.emsSource.tooltipsTitle": "ツールチップフィールド",
"xpack.maps.es_geo_utils.convert.invalidGeometryCollectionErrorMessage": "GeometryCollectionを convertESShapeToGeojsonGeometryに渡さないでください",
"xpack.maps.es_geo_utils.convert.unsupportedGeometryTypeErrorMessage": "{geometryType} ジオメトリから Geojson に変換できません。サポートされていません",
"xpack.maps.es_geo_utils.distanceFilterAlias": "{pointLabel} の {distanceKm}km 以内にある {geoFieldName}",
"xpack.maps.es_geo_utils.unsupportedFieldTypeErrorMessage": "サポートされていないフィールドタイプ、期待値:{expectedTypes}、提供された値:{fieldType}",
"xpack.maps.es_geo_utils.unsupportedGeometryTypeErrorMessage": "サポートされていないジオメトリタイプ、期待値:{expectedTypes}、提供された値:{geometryType}",
"xpack.maps.es_geo_utils.wkt.invalidWKTErrorMessage": "{wkt} を Geojson に変換できません。有効な WKT が必要です。",
Expand Down Expand Up @@ -13793,7 +13792,6 @@
"xpack.maps.metricSelect.selectAggregationPlaceholder": "集約を選択",
"xpack.maps.metricSelect.sumDropDownOptionLabel": "合計",
"xpack.maps.metricSelect.termsDropDownOptionLabel": "トップ用語",
"xpack.maps.multiIndexFieldSelect.fieldLabel": "フィールドのフィルタリング",
"xpack.maps.mvtSource.addFieldLabel": "追加",
"xpack.maps.mvtSource.fieldPlaceholderText": "フィールド名",
"xpack.maps.mvtSource.numberFieldLabel": "数字",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -13793,7 +13793,6 @@
"xpack.maps.emsSource.tooltipsTitle": "工具提示字段",
"xpack.maps.es_geo_utils.convert.invalidGeometryCollectionErrorMessage": "不应将 GeometryCollection 传递给 convertESShapeToGeojsonGeometry",
"xpack.maps.es_geo_utils.convert.unsupportedGeometryTypeErrorMessage": "无法将 {geometryType} 几何图形转换成 geojson,不支持",
"xpack.maps.es_geo_utils.distanceFilterAlias": "{pointLabel} {distanceKm}km 内的 {geoFieldName}",
"xpack.maps.es_geo_utils.unsupportedFieldTypeErrorMessage": "字段类型不受支持,应为 {expectedTypes},而提供的是 {fieldType}",
"xpack.maps.es_geo_utils.unsupportedGeometryTypeErrorMessage": "几何类型不受支持,应为 {expectedTypes},而提供的是 {geometryType}",
"xpack.maps.es_geo_utils.wkt.invalidWKTErrorMessage": "无法将 {wkt} 转换成 geojson。需要有效的 WKT。",
Expand Down Expand Up @@ -13974,7 +13973,6 @@
"xpack.maps.metricSelect.selectAggregationPlaceholder": "选择聚合",
"xpack.maps.metricSelect.sumDropDownOptionLabel": "求和",
"xpack.maps.metricSelect.termsDropDownOptionLabel": "热门词",
"xpack.maps.multiIndexFieldSelect.fieldLabel": "筛选字段",
"xpack.maps.mvtSource.addFieldLabel": "添加",
"xpack.maps.mvtSource.fieldPlaceholderText": "字段名称",
"xpack.maps.mvtSource.numberFieldLabel": "数字",
Expand Down

0 comments on commit 61c1e56

Please sign in to comment.