Skip to content

Commit

Permalink
[Bug] Check for valid layer pinned prop before performing comparison (#…
Browse files Browse the repository at this point in the history
…1297)

* [Bug] Check for valid layer pinned prop before performing comparison

Signed-off-by: Giuseppe Macri <macri.giuseppe@gmail.com>
  • Loading branch information
macrigiuseppe committed Oct 21, 2020
1 parent 42acc1c commit 3f0f7a6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/map-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions test/node/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ import './color-util-test';
import './util-test';
import './export-utils-test';
import './s2-utils-test';
import './map-info-utils-test';
34 changes: 34 additions & 0 deletions test/node/utils/map-info-utils-test.js
Original file line number Diff line number Diff line change
@@ -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();
});

0 comments on commit 3f0f7a6

Please sign in to comment.