From fa93ed332f4e7655bd45930ce6150b757c6ce069 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 26 Sep 2017 13:40:04 -0700 Subject: [PATCH] Lint and updated stylesheet unit tests --- __tests__/interface.test.js | 4 ++++ __tests__/utils/MapboxStyleSheet.test.js | 2 ++ example/src/components/GeoJSONSource.js | 2 +- example/src/components/IndoorBuilding.js | 2 +- example/src/components/WatercolorRasterTiles.js | 8 +------- javascript/components/AbstractLayer.js | 1 + javascript/components/Light.js | 4 +--- javascript/utils/MapboxStyleSheet.js | 5 ++--- 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/__tests__/interface.test.js b/__tests__/interface.test.js index 72fb47e..ffb4711 100644 --- a/__tests__/interface.test.js +++ b/__tests__/interface.test.js @@ -7,6 +7,7 @@ describe('Public Interface', () => { // components 'MapView', 'StyleSheet', + 'Light', // layers 'FillLayer', @@ -14,10 +15,13 @@ describe('Public Interface', () => { 'CircleLayer', 'LineLayer', 'SymbolLayer', + 'BackgroundLayer', + 'RasterLayer', // sources 'VectorSource', 'ShapeSource', + 'RasterSource', // constants 'UserTrackingModes', diff --git a/__tests__/utils/MapboxStyleSheet.test.js b/__tests__/utils/MapboxStyleSheet.test.js index e1411b5..771177a 100644 --- a/__tests__/utils/MapboxStyleSheet.test.js +++ b/__tests__/utils/MapboxStyleSheet.test.js @@ -154,10 +154,12 @@ describe('MapboxStyleSheet', () => { verifyStyleSheetsMatch(styles, { __MAPBOX_STYLESHEET__: true, water: { + __MAPBOX_STYLESHEET__: true, fillColor: { type: 'color', payload: { value: GREEN_INT } }, fillOpacity: { type: 'constant', payload: { value: 0.40 } }, }, building: { + __MAPBOX_STYLESHEET__: true, fillColor: { type: 'color', payload: { value: BLUE_INT } }, fillOpacity: { type: 'constant', payload: { value: 0.84 } }, }, diff --git a/example/src/components/GeoJSONSource.js b/example/src/components/GeoJSONSource.js index 59946c4..1f01979 100644 --- a/example/src/components/GeoJSONSource.js +++ b/example/src/components/GeoJSONSource.js @@ -6,7 +6,7 @@ import Page from './common/Page'; import sheet from '../styles/sheet'; -import gridPattern from '../assets/grid_pattern.png' +import gridPattern from '../assets/grid_pattern.png'; import smileyFaceGeoJSON from '../assets/smiley_face.json'; const layerStyles = MapboxGL.StyleSheet.create({ diff --git a/example/src/components/IndoorBuilding.js b/example/src/components/IndoorBuilding.js index db72408..bd48369 100644 --- a/example/src/components/IndoorBuilding.js +++ b/example/src/components/IndoorBuilding.js @@ -17,7 +17,7 @@ const styles = StyleSheet.create({ justifyContent: 'center', maxHeight: 60, paddingHorizontal: 24, - } + }, }); const layerStyles = MapboxGL.StyleSheet.create({ diff --git a/example/src/components/WatercolorRasterTiles.js b/example/src/components/WatercolorRasterTiles.js index 5905d04..e24c64c 100644 --- a/example/src/components/WatercolorRasterTiles.js +++ b/example/src/components/WatercolorRasterTiles.js @@ -17,12 +17,6 @@ const styles = StyleSheet.create({ justifyContent: 'center', maxHeight: 60, paddingHorizontal: 24, - } -}); - -const layerStyles = MapboxGL.StyleSheet.create({ - watercolors: { - rasterOpacity: 1, }, }); @@ -36,7 +30,7 @@ class WatercolorRasterTiles extends React.Component { this.state = { opacity: 1, - } + }; this.onOpacityChange = this.onOpacityChange.bind(this); } diff --git a/javascript/components/AbstractLayer.js b/javascript/components/AbstractLayer.js index 742efd5..0acef66 100644 --- a/javascript/components/AbstractLayer.js +++ b/javascript/components/AbstractLayer.js @@ -1,3 +1,4 @@ +/* eslint react/prop-types:0 */ import React from 'react'; import MapboxStyleSheet from '../utils/MapboxStyleSheet'; diff --git a/javascript/components/Light.js b/javascript/components/Light.js index 9fac0fe..e5b7393 100644 --- a/javascript/components/Light.js +++ b/javascript/components/Light.js @@ -1,11 +1,9 @@ import React from 'react'; -import { NativeModules, requireNativeComponent } from 'react-native'; +import { requireNativeComponent } from 'react-native'; import { LightLayerStyleProp } from '../utils/styleMap'; import AbstractLayer from './AbstractLayer'; -const MapboxGL = NativeModules.MGLModule; - export const NATIVE_MODULE_NAME = 'RCTMGLLight'; const RCTMGLLight = requireNativeComponent(NATIVE_MODULE_NAME, Light); diff --git a/javascript/utils/MapboxStyleSheet.js b/javascript/utils/MapboxStyleSheet.js index 78e03dc..53ec4dd 100644 --- a/javascript/utils/MapboxStyleSheet.js +++ b/javascript/utils/MapboxStyleSheet.js @@ -23,7 +23,7 @@ class MapStyleTransitionItem extends MapStyleItem { duration: duration, delay: delay, }, - ...extras + ...extras, }); } } @@ -32,7 +32,7 @@ class MapStyleTranslationItem extends MapStyleItem { constructor (x, y, extras = {}) { super(StyleTypes.Translation, { value: [x, y], - ...extras + ...extras, }); } } @@ -81,7 +81,6 @@ function makeStyleValue (prop, value, extras = {}) { let item; if (!isUndefined(value.type) && !isUndefined(value.payload)) { // function - console.log(prop, value); item = value; item.processStops(prop); } else if (styleMap[prop] === StyleTypes.Transition) {