mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-06 09:30:37 +02:00
67 lines
1.5 KiB
JavaScript
67 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
|
|
import { shallowWithIntl } from '../../helpers/mock-intl-enzyme';
|
|
import { Component as GenericMarker } from '../../../../app/component/map/GenericMarker';
|
|
|
|
describe('<GenericMarker />', () => {
|
|
it('should render', () => {
|
|
const props = {
|
|
getIcon: () => {},
|
|
leaflet: {
|
|
map: {
|
|
getZoom: () => {},
|
|
off: () => {},
|
|
on: () => {},
|
|
},
|
|
},
|
|
position: {
|
|
lat: 60,
|
|
lon: 25,
|
|
},
|
|
};
|
|
const wrapper = shallowWithIntl(<GenericMarker {...props} />, {
|
|
context: {
|
|
config: {
|
|
CONFIG: 'default',
|
|
map: {
|
|
genericMarker: {
|
|
popup: {},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
expect(wrapper.isEmptyRender()).to.equal(false);
|
|
});
|
|
|
|
it('should render empty if shouldRender returns false for the current zoom level', () => {
|
|
const props = {
|
|
getIcon: () => {},
|
|
leaflet: {
|
|
map: {
|
|
getZoom: () => 10,
|
|
off: () => {},
|
|
on: () => {},
|
|
},
|
|
},
|
|
position: {
|
|
lat: 60,
|
|
lon: 25,
|
|
},
|
|
shouldRender: zoom => zoom !== 10,
|
|
};
|
|
const wrapper = shallowWithIntl(<GenericMarker {...props} />, {
|
|
context: {
|
|
config: {
|
|
CONFIG: 'default',
|
|
map: {
|
|
genericMarker: {
|
|
popup: {},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
expect(wrapper.isEmptyRender()).to.equal(true);
|
|
});
|
|
});
|