Skip to content

Commit

Permalink
tests: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed May 28, 2018
1 parent 622dfd2 commit 5e7655e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { css } from 'styled-components'
import defaultBreakpoints from './theme/defaultBreakpoints'

const getBreakpoints = props =>
export const getBreakpoints = props =>
(props && props.theme && props.theme.breakpoints) || defaultBreakpoints

const getBreakpointsEntries = props => {
export const getBreakpointsEntries = props => {
const breakpoints = getBreakpoints(props)
const entries = Object.keys(breakpoints).reduce(
(entries, key) => [...entries, [key, breakpoints[key]]],
Expand All @@ -13,13 +13,13 @@ const getBreakpointsEntries = props => {
return entries.sort((a, b) => a[1] > b[1])
}

const getNextBreakpoint = (name, props) => {
export const getNextBreakpoint = (name, props) => {
const entries = getBreakpointsEntries(props)
const index = entries.findIndex(([key]) => key === name)
return index < entries.length - 1 ? entries[index + 1][0] : null
}

const getPreviousBreakpoint = (name, props) => {
export const getPreviousBreakpoint = (name, props) => {
const entries = getBreakpointsEntries(props)
const index = entries.findIndex(([key]) => key === name)
return index >= 1 ? entries[index - 1][0] : null
Expand All @@ -29,7 +29,7 @@ const getPreviousBreakpoint = (name, props) => {
* Minimum breakpoint width.
* Null for the smallest breakpoint.
*/
const getBreakpointMin = (name, props) => {
export const getBreakpointMin = (name, props) => {
const breakpoints = getBreakpoints(props)
const breakPoint = breakpoints[name]
return breakPoint !== 0 ? breakPoint : null
Expand All @@ -43,7 +43,7 @@ const getBreakpointMin = (name, props) => {
* Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
* See https://bugs.webkit.org/show_bug.cgi?id=178261
*/
const getBreakpointMax = (name, props) => {
export const getBreakpointMax = (name, props) => {
const next = getNextBreakpoint(name, props)
return next ? getBreakpointMin(next, props) - 0.02 : null
}
Expand Down

0 comments on commit 5e7655e

Please sign in to comment.