-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into greenkeeper/monorepo.gatsby-2.0.16
- Loading branch information
Showing
33 changed files
with
13,513 additions
and
123 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "10" | ||
|
||
branches: | ||
only: | ||
- master | ||
- tests | ||
- /^greenkeeper/.*$/ | ||
|
||
install: | ||
- yarn global add typescript | ||
- yarn install | ||
|
||
script: | ||
- yarn run lint | ||
- yarn run build | ||
- yarn run test:coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const React = require('react'); | ||
const gatsby = jest.requireActual('gatsby'); | ||
|
||
module.exports = { | ||
...gatsby, | ||
graphql: jest.fn(), | ||
Link: jest.fn().mockImplementation(({ to, ...rest }) => | ||
React.createElement('a', { | ||
...rest, | ||
href: to, | ||
}) | ||
), | ||
StaticQuery: jest.fn(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
module.exports = { | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
moduleNameMapper: { | ||
".+\\.(css|styl|less|sass|scss)$": "identity-obj-proxy", | ||
}, | ||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
testPathIgnorePatterns: ["node_modules", ".cache"], | ||
transformIgnorePatterns: ["node_modules/(?!(gatsby)/)"], | ||
globals: { | ||
"__PATH_PREFIX__": "" | ||
}, | ||
setupFiles: ["<rootDir>/tests/loadershim.js"], | ||
testURL: "http://localhost", | ||
moduleFileExtensions: [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node" | ||
], | ||
collectCoverageFrom: [ | ||
"src/**/*.ts", | ||
"src/**/*.tsx" | ||
], | ||
coverageReporters: [ | ||
"lcov", | ||
"text", | ||
"text-summary" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { shallow, configure } from 'enzyme'; | ||
import Footer from './index'; | ||
|
||
beforeEach(() => { | ||
configure({adapter: new Adapter}); | ||
}); | ||
|
||
test('Footer should render passed children correctly', () => { | ||
const el = shallow(<Footer><span>Test</span></Footer>); | ||
expect(el.contains(<span>Test</span>)).toBeTruthy(); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { configure, mount } from 'enzyme'; | ||
import Header from './index'; | ||
|
||
beforeEach(() => { | ||
configure({adapter: new Adapter}); | ||
}); | ||
|
||
describe('Navbar ', () => { | ||
describe('should set the state based on props', () => { | ||
it('should set transparent to false if props.transparent is false', () => { | ||
const el = mount(<Header siteTitle="test" transparent={false}/>); | ||
expect(el.state()).toEqual({transparent: false}); | ||
el.unmount(); | ||
}); | ||
|
||
it('should set transparent to true if props.transparent is true', () => { | ||
const el = mount(<Header siteTitle="test" transparent={true}/>); | ||
expect(el.state()).toEqual({transparent: true}); | ||
el.unmount(); | ||
}); | ||
}); | ||
|
||
it('should change the transparent state on window scroll if scrolling is > than window.height (768px)', () => { | ||
const el = mount(<Header siteTitle="test" transparent={true}/>); | ||
expect(el.state()).toEqual({transparent: true}); | ||
(global as any).pageYOffset = 1000; | ||
(el.instance() as any).handleScroll(); | ||
expect(el.state()).toEqual({transparent: false}); | ||
el.unmount(); | ||
}); | ||
|
||
it('should not change the transparent state on window scroll if scrolling is < than window.height (768px) - offset (100)', () => { | ||
const el = mount(<Header siteTitle="test" transparent={true}/>); | ||
expect(el.state()).toEqual({transparent: true}); | ||
(global as any).pageYOffset = 500; | ||
(el.instance() as any).handleScroll(); | ||
expect(el.state()).toEqual({transparent: true}); | ||
el.unmount(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const HeaderWrapper = styled.header` | ||
background: teal; | ||
padding: 0 3rem; | ||
`; | ||
|
||
export const HeaderBrand = styled.div` | ||
display: flex; | ||
align-items: center; | ||
flex-shrink: 0; | ||
margin-right: 1.5rem; | ||
`; | ||
|
||
export const HeaderTitle = styled.span` | ||
font-weight: 600; | ||
font-size: 1.5rem; | ||
letter-spacing: -.05em; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Navbar = styled('nav')<{transparent: boolean}>` | ||
margin: 0 auto; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
flex-wrap: wrap; | ||
padding: 1rem 1.5rem; | ||
box-shadow: 0 2px 4px 0 rgba(0,0,0,.1); | ||
position: fixed; | ||
width: 100%; | ||
z-index: 150; | ||
top: 0; | ||
left: 0; | ||
color: white; | ||
transition: background-color .1s; | ||
background: ${props => props.transparent ? 'transparent' : '#2f365f'}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { shallow, configure } from 'enzyme'; | ||
import Layout, { PureLayout } from './index'; | ||
import { SeoQuery } from '../../interfaces/seo'; | ||
|
||
beforeEach(() => { | ||
configure({adapter: new Adapter}); | ||
}); | ||
|
||
describe('Layout should render correctly', () => { | ||
it('should true', () => { | ||
const data: SeoQuery = { | ||
datoCmsSite: { | ||
name: 'Test', | ||
globalSeo: { | ||
siteName: 'Test', | ||
}, | ||
}, | ||
}; | ||
const el = shallow(<PureLayout data={data}>test</PureLayout>); | ||
expect(el.contains('test')).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.