Skip to content

Commit

Permalink
Merge branch 'master' into jw-grid-font
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwentz authored Aug 11, 2017
2 parents 612461f + fd40e05 commit cf723e7
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 38 deletions.
2 changes: 1 addition & 1 deletion content/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- title: US Territory Data
description: |
Summary data from United States territories including Puerto Rico, American Samoa, Guam and the U.S. Virgin Islands. Download this dataset to see totals of reported crime for U.S. territories between 1995 and 2015.
download: 'http://s3-us-gov-west-1.amazonaws.com/cg-d3f0433b-a53e-4934-8b94-c678aa2cbaf3/territories.csv'
href: 'http://s3-us-gov-west-1.amazonaws.com/cg-d3f0433b-a53e-4934-8b94-c678aa2cbaf3/territories.csv'
- title: Arrest Data
description: |
National arrest data is estimated by the FBI and dates back to 1995. Arrest data contains monthly counts of arrests for various offenses broken down by age and sex or age and race. Not all agencies report race and ethnicity for arrests but they must report age and sex. Note that only agencies that have reported arrests for 12 months are counted for the annual counts that are included in the database.
Expand Down
22 changes: 11 additions & 11 deletions src/containers/App.js → src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import React from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import Analytics from '../components/Analytics'
import BetaBanner from '../components/BetaBanner'
import ClearCacheBtn from '../components/ClearCacheBtn'
import Disclaimer from '../components/Disclaimer'
import Feedback from '../components/Feedback'
import Footer from '../components/Footer'
import Glossary from '../components/Glossary'
import Header from '../components/Header'
import SkipContent from '../components/SkipContent'
import * as feedbackActions from '../actions/feedback'
import * as glossaryActions from '../actions/glossary'
import Analytics from './components/Analytics'
import BetaBanner from './components/BetaBanner'
import ClearCacheBtn from './components/ClearCacheBtn'
import Disclaimer from './components/Disclaimer'
import Feedback from './components/Feedback'
import Footer from './components/Footer'
import Glossary from './components/Glossary'
import Header from './components/Header'
import SkipContent from './components/SkipContent'
import * as feedbackActions from './actions/feedback'
import * as glossaryActions from './actions/glossary'

const isProd = process.env.NODE_ENV === 'production'

Expand Down
8 changes: 4 additions & 4 deletions src/components/About.js → src/pages/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Helmet from 'react-helmet'
import { Link } from 'react-router'
import reduceEntries from 'reduce-entries'

import SharingTags from './SharingTags'
import Term from './Term'
import UsaMap from './UsaMap'
import SharingTags from '../components/SharingTags'
import Term from '../components/Term'
import UsaMap from '../components/UsaMap'

import DownloadDataBtn from './DownloadDataBtn'
import DownloadDataBtn from '../components/DownloadDataBtn'
import { showFeedback } from '../actions/feedback'
import participation from '../util/participation'
import { data as usaData, nationalKey } from '../util/usa'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import React from 'react'
import Helmet from 'react-helmet'

import DownloadBulkNibrs from './DownloadBulkNibrs'
import DownloadDataBtn from './DownloadDataBtn'
import SharingTags from './SharingTags'
import Term from './Term'
import DownloadBulkNibrs from '../components/DownloadBulkNibrs'
import DownloadDataBtn from '../components/DownloadDataBtn'
import SharingTags from '../components/SharingTags'
import Term from '../components/Term'
import otherDatasets from '../../content/datasets.yml'
import markdown from '../util/md'

Expand Down
4 changes: 2 additions & 2 deletions src/components/Explorer.js → src/pages/Explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import PropTypes from 'prop-types'
import React from 'react'
import Helmet from 'react-helmet'

import AboutTheData from './AboutTheData'
import AboutTheData from '../components/AboutTheData'
import AgencyChartContainer from '../containers/AgencyChartContainer'
import ExplorerHeaderContainer from '../containers/ExplorerHeaderContainer'
import NibrsContainer from '../containers/NibrsContainer'
import NotFound from './NotFound'
import SharingTags from './SharingTags'
import SharingTags from '../components/SharingTags'
import SidebarContainer from '../containers/SidebarContainer'
import SparklineContainer from '../containers/SparklineContainer'
import TrendContainer from '../containers/TrendContainer'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/NotFound.js → src/pages/NotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import Helmet from 'react-helmet'
import { connect } from 'react-redux'

import Link from './Link'
import Link from '../components/Link'
import { showFeedback } from '../actions/feedback'

const NotFound = ({ dispatch }) =>
Expand Down
12 changes: 6 additions & 6 deletions src/routes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import { IndexRoute, Route, Router } from 'react-router'

import About from './components/About'
import App from './containers/App'
import DownloadsAndDocs from './components/DownloadsAndDocs'
import Explorer from './components/Explorer'
import Home from './containers/Home'
import NotFound from './components/NotFound'
import About from './pages/About'
import App from './App'
import DownloadsAndDocs from './pages/DownloadsAndDocs'
import Explorer from './pages/Explorer'
import Home from './pages/Home'
import NotFound from './pages/NotFound'
import history from './util/history'

const scrollToTop = () => window.scroll(0, 0)
Expand Down
18 changes: 9 additions & 9 deletions src/util/usa.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ import startCase from 'lodash.startcase'
const nationalKey = 'united-states'
const data = [
{ id: 'usa', slug: nationalKey },
{ id: 'ak', slug: 'alaska' },
{ id: 'al', slug: 'alabama' },
{ id: 'ar', slug: 'arkansas' },
{ id: 'ak', slug: 'alaska' },
{ id: 'az', slug: 'arizona' },
{ id: 'ar', slug: 'arkansas' },
{ id: 'ca', slug: 'california' },
{ id: 'co', slug: 'colorado' },
{ id: 'ct', slug: 'connecticut' },
{ id: 'de', slug: 'delaware' },
{ id: 'fl', slug: 'florida' },
{ id: 'ga', slug: 'georgia' },
{ id: 'hi', slug: 'hawaii' },
{ id: 'ia', slug: 'iowa' },
{ id: 'id', slug: 'idaho' },
{ id: 'ia', slug: 'iowa' },
{ id: 'il', slug: 'illinois' },
{ id: 'in', slug: 'indiana' },
{ id: 'ks', slug: 'kansas' },
{ id: 'ky', slug: 'kentucky' },
{ id: 'la', slug: 'louisiana' },
{ id: 'ma', slug: 'massachusetts' },
{ id: 'md', slug: 'maryland' },
{ id: 'me', slug: 'maine' },
{ id: 'md', slug: 'maryland' },
{ id: 'ma', slug: 'massachusetts' },
{ id: 'mi', slug: 'michigan' },
{ id: 'mn', slug: 'minnesota' },
{ id: 'mo', slug: 'missouri' },
{ id: 'ms', slug: 'mississippi' },
{ id: 'mo', slug: 'missouri' },
{ id: 'mt', slug: 'montana' },
{ id: 'ne', slug: 'nebraska' },
{ id: 'nc', slug: 'north-carolina' },
{ id: 'nd', slug: 'north-dakota' },
{ id: 'ne', slug: 'nebraska' },
{ id: 'nh', slug: 'new-hampshire' },
{ id: 'nj', slug: 'new-jersey' },
{ id: 'nm', slug: 'new-mexico' },
Expand All @@ -47,12 +47,12 @@ const data = [
{ id: 'tn', slug: 'tennessee' },
{ id: 'tx', slug: 'texas' },
{ id: 'ut', slug: 'utah' },
{ id: 'va', slug: 'virginia' },
{ id: 'vt', slug: 'vermont' },
{ id: 'va', slug: 'virginia' },
{ id: 'wa', slug: 'washington' },
{ id: 'dc', display: 'Washington, DC', slug: 'washington-dc' },
{ id: 'wi', slug: 'wisconsin' },
{ id: 'wv', slug: 'west-virginia' },
{ id: 'wi', slug: 'wisconsin' },
{ id: 'wy', slug: 'wyoming' },
].map(d => ({
...d,
Expand Down
34 changes: 34 additions & 0 deletions test/util/github.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* eslint no-undef: 0 */

import axios from 'axios'
import sinon from 'sinon'

import { createIssue } from '../../src/util/github'

describe('github utility', () => {
let sandbox
const fakeIssue = {
body: 'fake text',
owner: '18f',
repo: 'fake-repo',
title: 'fake title',
token: 'fake-token',
}

beforeEach(() => {
sandbox = sinon.sandbox.create()
})

afterEach(() => {
sandbox.restore()
})

it('should post data to the github api', done => {
const spy = sandbox.stub(axios, 'post', () => Promise.resolve([]))
createIssue(fakeIssue).then(() => {
const url = spy.getCall(0).args[0]
expect(url).toEqual('https://api.github.com/repos/18f/fake-repo/issues')
done()
})
})
})
17 changes: 17 additions & 0 deletions test/util/md.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint no-undef: 0 */

import markdown from '../../src/util/md'

describe('markdown util', () => {
it('should render markdown to html', () => {
const actual = markdown.render('# test\nfake text')
expect(actual.trim()).toEqual('<h1>test</h1>\n<p>fake text</p>')
})

it('should properly render glossary links', () => {
const actual = markdown.render('[yo](#glossary?term=yo)')
expect(actual.trim()).toEqual(
'<p><a href="#glossary?term=yo" class="underline glossary-icon glossary-icon-md">yo</a></p>',
)
})
})

0 comments on commit cf723e7

Please sign in to comment.