Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Bug] Check for valid layer pinned prop before performing comparison (#1297)

Giuseppe Macrì3f0f7a6ce33e
diff --git a/src/components/map-container.js b/src/components/map-container.js
index 39fc9333f..e43e39068 100644
--- a/src/components/map-container.js
+++ b/src/components/map-container.js
@@ -302,7 +302,7 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
layersToRender,
datasets
});
- if (layerHoverProp) {
+ if (layerHoverProp && layerPinnedProp) {
layerHoverProp.primaryData = layerPinnedProp.data;
layerHoverProp.compareType = interactionConfig.tooltip.config.compareType;
}
diff --git a/test/node/utils/index.js b/test/node/utils/index.js
index 758721257..b47371862 100644
--- a/test/node/utils/index.js
+++ b/test/node/utils/index.js
@@ -32,3 +32,4 @@ import './color-util-test';
import './util-test';
import './export-utils-test';
import './s2-utils-test';
+import './map-info-utils-test';
diff --git a/test/node/utils/map-info-utils-test.js b/test/node/utils/map-info-utils-test.js
new file mode 100644
index 000000000..84d14f2ad
--- /dev/null
+++ b/test/node/utils/map-info-utils-test.js
@@ -0,0 +1,34 @@
+import test from 'tape';
+import {isValidMapInfo} from 'utils/map-info-utils';
+
+test('mapInfoUtils -> isValidMapInfo', t => {
+ t.equal(
+ isValidMapInfo({title: 'example', description: ''}),
+ true,
+ 'Should validate map info with no description'
+ );
+ t.equal(
+ isValidMapInfo({title: 'example', description: 'this is a map'}),
+ true,
+ 'Should validate map info with description'
+ );
+ t.equal(
+ isValidMapInfo({
+ title:
+ 'this is a really long title for a map that is not going to work because i really do not like this kind of long title',
+ description: 'this is a map'
+ }),
+ false,
+ 'Should validate map with a really long title'
+ );
+ t.equal(
+ isValidMapInfo({
+ description:
+ 'this is a really long description for a map that is not going to work because i really do not like this kind of long title',
+ title: 'this is a map'
+ }),
+ false,
+ 'Should validate map with a really long description'
+ );
+ t.end();
+});