diff --git a/src/visits/ShortUrlVisits.js b/src/visits/ShortUrlVisits.js
index ec1d8a42..d3644404 100644
--- a/src/visits/ShortUrlVisits.js
+++ b/src/visits/ShortUrlVisits.js
@@ -106,7 +106,7 @@ const ShortUrlVisits = ({
extraHeaderContent={[
() => (
),
diff --git a/src/visits/helpers/OpenMapModalBtn.js b/src/visits/helpers/OpenMapModalBtn.js
index f775be40..afe00d1c 100644
--- a/src/visits/helpers/OpenMapModalBtn.js
+++ b/src/visits/helpers/OpenMapModalBtn.js
@@ -8,14 +8,14 @@ import './OpenMapModalBtn.scss';
export default class OpenMapModalBtn extends React.Component {
static propTypes = {
- title: PropTypes.string.isRequired,
+ modalTitle: PropTypes.string.isRequired,
locations: PropTypes.arrayOf(PropTypes.object),
};
state = { mapIsOpened: false };
render() {
- const { title, locations = [] } = this.props;
+ const { modalTitle, locations = [] } = this.props;
const toggleMap = () => this.setState(({ mapIsOpened }) => ({ mapIsOpened: !mapIsOpened }));
const buttonRef = React.createRef();
@@ -25,7 +25,7 @@ export default class OpenMapModalBtn extends React.Component {
buttonRef.current}>Show in map
-
+
);
}
diff --git a/test/visits/services/VisitsParser.test.js b/test/visits/services/VisitsParser.test.js
index 6e62d76e..f5002e7c 100644
--- a/test/visits/services/VisitsParser.test.js
+++ b/test/visits/services/VisitsParser.test.js
@@ -4,6 +4,7 @@ import {
processReferrersStats,
processCountriesStats,
processCitiesStats,
+ processCitiesStatsForMap,
} from '../../../src/visits/services/VisitsParser';
describe('VisitsParser', () => {
@@ -14,6 +15,8 @@ describe('VisitsParser', () => {
visitLocation: {
countryName: 'Spain',
cityName: 'Zaragoza',
+ latitude: '123.45',
+ longitude: '-543.21',
},
},
{
@@ -22,6 +25,8 @@ describe('VisitsParser', () => {
visitLocation: {
countryName: 'United States',
cityName: 'New York',
+ latitude: '1029',
+ longitude: '6758',
},
},
{
@@ -36,6 +41,8 @@ describe('VisitsParser', () => {
visitLocation: {
countryName: 'Spain',
cityName: 'Zaragoza',
+ latitude: '123.45',
+ longitude: '-543.21',
},
},
{
@@ -92,4 +99,26 @@ describe('VisitsParser', () => {
});
});
});
+
+ describe('processCitiesStatsForMap', () => {
+ it('properly parses cities stats with lat and long', () => {
+ const zaragozaLat = 123.45;
+ const zaragozaLong = -543.21;
+ const newYorkLat = 1029;
+ const newYorkLong = 6758;
+
+ expect(processCitiesStatsForMap(visits)).toEqual({
+ 'Zaragoza': {
+ cityName: 'Zaragoza',
+ count: 2,
+ latLong: [ zaragozaLat, zaragozaLong ],
+ },
+ 'New York': {
+ cityName: 'New York',
+ count: 1,
+ latLong: [ newYorkLat, newYorkLong ],
+ },
+ });
+ });
+ });
});