mirror of
https://github.com/visgl/react-map-gl.git
synced 2025-12-08 20:16:02 +00:00
* Compile with buble and bundle with webpack * Reduce number of dependencies * Support for tree-shaking * Standalone, easy-to-understand example with small package.json * Tests now work under Node.js even when loading mapbox-gl. * Fix travis config
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
import test from 'tape-catch';
|
|
import Immutable from 'immutable';
|
|
import deepEqual from 'deep-equal';
|
|
import {getInteractiveLayerIds} from 'react-map-gl/utils/style-utils';
|
|
|
|
const TEST_STYLE_STRING = 'mapbox://styles/mapbox/streets-v9';
|
|
const TEST_STYLE_JS = {
|
|
layers: [
|
|
{
|
|
id: 'interactive',
|
|
interactive: true
|
|
}, {
|
|
id: 'non-interactive',
|
|
interactive: false
|
|
}
|
|
]
|
|
};
|
|
const TEST_STYLE_IMMUTABLE = Immutable.fromJS(TEST_STYLE_JS);
|
|
|
|
test('getInteractiveLayerIds#String style', t => {
|
|
const layers = getInteractiveLayerIds(TEST_STYLE_STRING);
|
|
t.equal(deepEqual(layers, []), true, 'got expected layer ids');
|
|
t.end();
|
|
});
|
|
|
|
test('getInteractiveLayerIds#JS style', t => {
|
|
const layers = getInteractiveLayerIds(TEST_STYLE_JS);
|
|
t.equal(deepEqual(layers, ['interactive']), true, 'got expected layer ids');
|
|
t.end();
|
|
});
|
|
|
|
test('getInteractiveLayerIds#Immutable style', t => {
|
|
const layers = getInteractiveLayerIds(TEST_STYLE_IMMUTABLE);
|
|
t.equal(deepEqual(layers, ['interactive']), true, 'got expected layer ids');
|
|
t.end();
|
|
});
|