This repository has been archived by the owner on Dec 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
51 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { matcher, serializer } from 'jest-glamor-react'; | ||
import Button from './Button'; | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import { matcher, serializer } from 'jest-glamor-react' | ||
import Button from './Button' | ||
|
||
expect.addSnapshotSerializer(serializer); | ||
expect.extend(matcher); | ||
expect.addSnapshotSerializer(serializer) | ||
expect.extend(matcher) | ||
|
||
describe('<Button />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = shallow( | ||
<Button theme={{ colors: { blue: 'blue' } }}>hello</Button> | ||
); | ||
expect(wrapper).toMatchSnapshotWithGlamor(); | ||
}); | ||
}); | ||
) | ||
expect(wrapper).toMatchSnapshotWithGlamor() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { matcher, serializer } from 'jest-glamor-react'; | ||
import { ThemeProvider } from 'glamorous'; | ||
import Counter from './Counter'; | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import { matcher, serializer } from 'jest-glamor-react' | ||
import { ThemeProvider } from 'glamorous' | ||
import Counter from './Counter' | ||
|
||
expect.addSnapshotSerializer(serializer); | ||
expect.extend(matcher); | ||
expect.addSnapshotSerializer(serializer) | ||
expect.extend(matcher) | ||
|
||
describe('<Counter />', () => { | ||
const onIncrement = jest.fn(); | ||
const onIncrement = jest.fn() | ||
it('renders correctly', () => { | ||
const wrapper = mount( | ||
<ThemeProvider theme={{ colors: { green: '' } }}> | ||
<Counter onIncrement={onIncrement} /> | ||
</ThemeProvider> | ||
); | ||
expect(wrapper).toMatchSnapshotWithGlamor(); | ||
wrapper.find('button').simulate('click'); | ||
expect(onIncrement).toHaveBeenCalled(); | ||
}); | ||
}); | ||
) | ||
expect(wrapper).toMatchSnapshotWithGlamor() | ||
wrapper.find('button').simulate('click') | ||
expect(onIncrement).toHaveBeenCalled() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import 'sanitize.css/sanitize.css'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import 'sanitize.css/sanitize.css' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
|
||
const rootEl = document.getElementById('root'); | ||
const rootEl = document.getElementById('root') | ||
|
||
let render = () => { | ||
const Root = require('./components/Root').default; | ||
ReactDOM.render(<Root />, rootEl); | ||
}; | ||
const Root = require('./components/Root').default | ||
ReactDOM.render(<Root />, rootEl) | ||
} | ||
|
||
if (module.hot) { | ||
const renderApp = render; | ||
const renderApp = render | ||
const renderError = err => { | ||
const RedBox = require('redbox-react'); | ||
ReactDOM.render(<RedBox error={err} />, rootEl); | ||
}; | ||
const RedBox = require('redbox-react') | ||
ReactDOM.render(<RedBox error={err} />, rootEl) | ||
} | ||
render = () => { | ||
try { | ||
renderApp(); | ||
renderApp() | ||
} catch (err) { | ||
renderError(err); | ||
renderError(err) | ||
} | ||
}; | ||
module.hot.accept('./components/Root', render); | ||
} | ||
module.hot.accept('./components/Root', render) | ||
} | ||
|
||
render(); | ||
render() |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ export default { | |
blue: '#0074D9', | ||
grey: 'rgba(0,0,0,.4)' | ||
} | ||
}; | ||
} |