Skip to content

Commit

Permalink
Merge pull request #105 from conveyal/dev
Browse files Browse the repository at this point in the history
v0.7.0
  • Loading branch information
trevorgerhardt authored May 31, 2017
2 parents 08ff877 + e1a8f2c commit 2e06b88
Show file tree
Hide file tree
Showing 83 changed files with 11,108 additions and 3,245 deletions.
12 changes: 12 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[ignore]
.*/node_modules/auth0-lock/.*
.*/node_modules/config-chain/.*
.*/node_modules/npmconf/.*
.*/node_modules/mapbox.js/docs/examples/.*
.*/node_modules/react-leaflet/src/.*

[include]

[libs]

[options]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ assets
configurations/*
!configurations/default
!configurations/messages
tmp
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
sudo: false
language: node_js
cache:
directories:
- ~/.yarn-cache
yarn: true
notifications:
email: false
node_js:
- '6'
before_install:
- npm i -g yarn
install:
- yarn
- yarn global add codecov
scripts:
- yarn test -- --coverage --coverage-paths src/**/*.js
- codecov
- yarn run build
after_success:
- yarn run semantic-release
branches:
Expand Down
176 changes: 176 additions & 0 deletions __mocks__/leaflet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/* global jest, module, require */

import assign from 'lodash/assign'

const L = require.requireActual('leaflet')
const LeafletMock = jest.genMockFromModule('leaflet')

class ControlMock extends LeafletMock.Control {
constructor (options) {
super()
this.options = {...L.Control.prototype.options, ...options}
}

getPosition () {
return this.options.position
}

setPosition (position) {
this.options.position = position
return this
}
}

const controlMock = options => new ControlMock(options)

class LayersControlMock extends ControlMock {
constructor (baseLayers = [], overlays = [], options) {
super(options)
this._layers = []

baseLayers.forEach((layer, i) => {
this._addLayer(layer, i)
})
overlays.forEach((layer, i) => {
this._addLayer(layer, i, true)
})
}

_addLayer (layer, name, overlay) {
this._layers.push({layer, name, overlay})
}

addBaseLayer (layer, name) {
this._addLayer(layer, name)
return this
}

addOverlay (layer, name) {
this._addLayer(layer, name, true)
return this
}

removeLayer (obj) {
this._layers.splice(this._layers.indexOf(obj), 1)
}
}

ControlMock.Layers = LayersControlMock
controlMock.layers = (baseLayers, overlays, options) => {
return new LayersControlMock(baseLayers, overlays, options)
}

class MapMock extends LeafletMock.Map {
constructor (id, options = {}) {
super()
assign(this, L.Mixin.Events)

this.options = {...L.Map.prototype.options, ...options}
this._container = id

if (options.bounds) {
this.fitBounds(options.bounds, options.boundsOptions)
}

if (options.maxBounds) {
this.setMaxBounds(options.maxBounds)
}

if (options.center && options.zoom !== undefined) {
this.setView(L.latLng(options.center), options.zoom)
}
}

_limitZoom (zoom) {
const min = this.getMinZoom()
const max = this.getMaxZoom()
return Math.max(min, Math.min(max, zoom))
}

_resetView (center, zoom) {
this._initialCenter = center
this._zoom = zoom
}

fitBounds (bounds, options) {
this._bounds = bounds
this._boundsOptions = options
}

getBounds () {
return this._bounds
}

getCenter () {
return this._initialCenter
}

getMaxZoom () {
return this.options.maxZoom === undefined ? Infinity : this.options.maxZoom
}

getMinZoom () {
return this.options.minZoom === undefined ? 0 : this.options.minZoom
}

getZoom () {
return this._zoom
}

setMaxBounds (bounds) {
bounds = L.latLngBounds(bounds)
this.options.maxBounds = bounds
return this
}

setView (center, zoom) {
zoom = zoom === undefined ? this.getZoom() : zoom
this._resetView(L.latLng(center), this._limitZoom(zoom))
return this
}

setZoom (zoom) {
return this.setView(this.getCenter(), zoom)
}
}

class PopupMock extends LeafletMock.Popup {
constructor (options, source) {
super()
assign(this, L.Mixin.Events)

this.options = {...L.Popup.prototype.options, ...options}
this._source = source
}

getContent () {
return this._content
}

setContent (content) {
this._content = content
}
}

module.exports = {
...LeafletMock,
Control: ControlMock,
control: controlMock,
LatLng: L.LatLng,
latLng: L.latLng,
LatLngBounds: L.LatLngBounds,
latLngBounds: L.latLngBounds,
geoJson (data, props) {
return {
data,
getLayers () {
return []
},
props
}
},
Map: MapMock,
map: (id, options) => new MapMock(id, options),
Popup: PopupMock,
popup: (options, source) => new PopupMock(options, source)
}
7 changes: 7 additions & 0 deletions __mocks__/react-leaflet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* global jest */
const ReactLeaflet = require.requireActual('react-leaflet')
const ReactLeafletMock = jest.genMockFromModule('react-leaflet')

ReactLeaflet.ZoomControl = ReactLeafletMock.ZoomControl

module.exports = ReactLeaflet
4 changes: 4 additions & 0 deletions configurations/default/messages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Systems:
CalculatingAccessibility: Calculating accessibility...
SelectStart: Select a location to see accessibility
SelectEnd: Select an endpoint to see possible trips
Show: show
AccessTitle: Access to
BaseTitle: Proposed Transit
ComparisonTitle: Current Transit
Expand Down
1 change: 0 additions & 1 deletion configurations/default/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ entries:
env: development
flyle: true
s3bucket: taui
serve: true
43 changes: 31 additions & 12 deletions configurations/default/store.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
browsochrones:
active: base
base: null
comparison: null
active: 0
instances: []
gridsUrl: https://dz69bcpxxuhn6.cloudfront.net/indy-baseline-z9/intgrids
grids:
- Jobs_total
- Workers_total
origins:
- https://dz69bcpxxuhn6.cloudfront.net/indyconnect-marion-v6
- https://dz69bcpxxuhn6.cloudfront.net/indy-baseline-v6
- name: Baseline
url: https://dz69bcpxxuhn6.cloudfront.net/indy-baseline-v6
- name: Marion
url: https://dz69bcpxxuhn6.cloudfront.net/indyconnect-marion-v6
destinations: []
geocoder:
focusLatlng:
lat: 39.7691
lng: -86.1570
boundary:
country: us
rect:
maxLatlng:
lat: 40.271143686084194
lng: -85.462646484375
minLatlng:
lat: 39.35978526869001
lng: -86.8524169921875
maxLat: 40.271143686084194
maxLon: -85.462646484375
minLat: 39.35978526869001
minLon: -86.8524169921875
pointsOfInterest:
- name: Location 1
coordinates: [-86.1570, 39.7691]
- name: Location 2
coordinates: [-86.1580, 39.7681]
map:
active: base
active: 0
centerCoordinates: [39.7691, -86.1570]
geojson: []
zoom: 11
transitive: null
isochrones: []
transitives: []
travelTimes: []
inVehicleTravelTimes: []
waitTimes: []
zoom: 11
mapMarkers:
start: {}
end: {}
timeCutoff:
selected: 60
times: []
ui:
fetches: 0
showLog: true
7 changes: 7 additions & 0 deletions configurations/test/env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BROWSOCHRONES_BASE_URL:
LEAFLET_TILE_URL:
LEAFLET_RETINA_URL:
LEAFLET_ATTRIBUTION:
MAPBOX_ACCESS_TOKEN:
MAPZEN_SEARCH_KEY:

38 changes: 38 additions & 0 deletions flow-typed/npm/@conveyal/lonlat_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// flow-typed signature: 351afdb4dc19c4d3a1be1ffa1fa58d3f
// flow-typed version: <<STUB>>/@conveyal/lonlat_v^1.1.1/flow_v0.45.0

/**
* This is an autogenerated libdef stub for:
*
* '@conveyal/lonlat'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@conveyal/lonlat' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@conveyal/lonlat/index.test' {
declare module.exports: any;
}

// Filename aliases
declare module '@conveyal/lonlat/index' {
declare module.exports: $Exports<'@conveyal/lonlat'>;
}
declare module '@conveyal/lonlat/index.js' {
declare module.exports: $Exports<'@conveyal/lonlat'>;
}
declare module '@conveyal/lonlat/index.test.js' {
declare module.exports: $Exports<'@conveyal/lonlat/index.test'>;
}
Loading

0 comments on commit 2e06b88

Please sign in to comment.