Skip to content

Commit

Permalink
add render tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Oct 31, 2019
1 parent b42d33a commit 805e925
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
Binary file added test/render/golden-images/source-01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/render/golden-images/source-02.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 56 additions & 1 deletion test/render/test-cases.js
@@ -1,6 +1,6 @@
/* global __MAPBOX_TOKEN__ */
import React from 'react';
import {StaticMap, NavigationControl, Popup} from 'react-map-gl';
import {StaticMap, NavigationControl, Popup, Source, Layer} from 'react-map-gl';

const EMPTY_MAP_STYLE = {
version: 8,
Expand Down Expand Up @@ -79,5 +79,60 @@ export default [
]
},
goldenImage: 'test/render/golden-images/popup.png'
},
{
title: 'JSX Source/Layer',
Component: StaticMap,
props: {
mapboxApiAccessToken: __MAPBOX_TOKEN__,
mapStyle: EMPTY_MAP_STYLE,
longitude: -122.4,
latitude: 37.78,
zoom: 12.5,
children: [
<Source
key="geojson-data"
type="geojson"
data={{type: 'Feature', geometry: {type: 'Point', coordinates: [-122.4, 37.78]}}}
>
<Layer type="circle" paint={{'circle-radius': 10, 'circle-color': '#08f'}} />
</Source>
]
},
goldenImage: 'test/render/golden-images/source-01.png'
},
{
title: 'JSX Source/Layer toggle style',
Component: StaticMap,
props: {
mapboxApiAccessToken: __MAPBOX_TOKEN__,
mapStyle: 'mapbox://styles/mapbox/dark-v9',
longitude: -122.4,
latitude: 37.78,
zoom: 12.5,
children: [
<Source
key="geojson-data"
type="geojson"
data={{type: 'Feature', geometry: {type: 'Point', coordinates: [-122.4, 37.78]}}}
>
<Layer type="circle" paint={{'circle-radius': 10, 'circle-color': '#08f'}} />
</Source>
]
},
goldenImage: 'test/render/golden-images/source-02.png'
},
{
title: 'JSX Source/Layer removal',
Component: StaticMap,
props: {
mapboxApiAccessToken: __MAPBOX_TOKEN__,
mapStyle: 'mapbox://styles/mapbox/dark-v9',
longitude: -122.4,
latitude: 37.78,
zoom: 12.5,
children: []
},
goldenImage: 'test/render/golden-images/basic-map.png'
}
];

0 comments on commit 805e925

Please sign in to comment.