Skip to content

Commit 4d6b6cb

Browse files
committed
removed sinon dependency in lieu of using jest.spyOn and added example to README.md
1 parent 23553d8 commit 4d6b6cb

4 files changed

Lines changed: 19 additions & 117 deletions

File tree

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Check [here](https://codesandbox.io/s/mqx0ql55qp)
3131
* spinningBubbles
3232
* spokes
3333

34-
## Example
34+
## Examples
3535

3636
```javascript
3737
import React from 'react';
@@ -44,15 +44,26 @@ const Example = ({ type, color }) => (
4444
export default Example;
4545
```
4646

47+
```javascript
48+
import React from 'react';
49+
import ReactLoading from 'react-loading';
50+
51+
const Example = ({ type, color }) => (
52+
<ReactLoading type={type} color={color} height={'20%'} width={'20%'} />
53+
);
54+
55+
export default Example;
56+
```
57+
4758
### Props
4859

4960
| Name | Type | Default Value |
5061
|:------:|:------:|:---------------:|
5162
| type | String | balls |
5263
| color | String | `#ffffff` |
5364
| delay | Number | 0 (msecs) |
54-
| height | Number | 64 (px) |
55-
| width | Number | 64 (px) |
65+
| height | Number or String | 64 (px) |
66+
| width | Number or String | 64 (px) |
5667
| className | String | `''` |
5768

5869

lib/__tests__/react-loading.spec.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import sinon from 'sinon';
43

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

@@ -54,10 +53,10 @@ describe('test Loading component', () => {
5453
});
5554

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

package-lock.json

Lines changed: 0 additions & 107 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"react-dom": ">=0.14.0",
6767
"react-test-renderer": "^16.0.0",
6868
"rimraf": "^2.6.1",
69-
"sinon": "^5.0.7",
7069
"webpack": "^3.8.1"
7170
},
7271
"jest": {

0 commit comments

Comments
 (0)