Skip to content

Commit

Permalink
removed sinon dependency in lieu of using jest.spyOn and added exampl…
Browse files Browse the repository at this point in the history
…e to README.md
  • Loading branch information
dcgudeman committed Jul 8, 2018
1 parent 23553d8 commit 4d6b6cb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 117 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Check [here](https://codesandbox.io/s/mqx0ql55qp)
* spinningBubbles
* spokes

## Example
## Examples

```javascript
import React from 'react';
Expand All @@ -44,15 +44,26 @@ const Example = ({ type, color }) => (
export default Example;
```

```javascript
import React from 'react';
import ReactLoading from 'react-loading';

const Example = ({ type, color }) => (
<ReactLoading type={type} color={color} height={'20%'} width={'20%'} />
);

export default Example;
```

### Props

| Name | Type | Default Value |
|:------:|:------:|:---------------:|
| type | String | balls |
| color | String | `#ffffff` |
| delay | Number | 0 (msecs) |
| height | Number | 64 (px) |
| width | Number | 64 (px) |
| height | Number or String | 64 (px) |
| width | Number or String | 64 (px) |
| className | String | `''` |


Expand Down
11 changes: 5 additions & 6 deletions lib/__tests__/react-loading.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';

import Loading from '../react-loading';

Expand Down Expand Up @@ -54,10 +53,10 @@ describe('test Loading component', () => {
});

it('allows setting height and width with strings without propTypes warnings', () => {
const spyConsoleError = sinon.spy(console, 'error');
const enzymeWrapper = shallow(<Loading height={'20%'} width={'20%'} />);
expect(spyConsoleError.callCount).toEqual(0);
spyConsoleError.restore();
const spyConsoleError = jest.spyOn(global.console, 'error');
const enzymeWrapper = shallow(<Loading height="20%" width="20%" />);
expect(enzymeWrapper).toHaveLength(1);
expect(spyConsoleError).not.toHaveBeenCalled();
spyConsoleError.mockRestore();
});

});
107 changes: 0 additions & 107 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"react-dom": ">=0.14.0",
"react-test-renderer": "^16.0.0",
"rimraf": "^2.6.1",
"sinon": "^5.0.7",
"webpack": "^3.8.1"
},
"jest": {
Expand Down

0 comments on commit 4d6b6cb

Please sign in to comment.