Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit ee63f1b

Browse files
committed
rm -r
1 parent e902374 commit ee63f1b

File tree

7 files changed

+7382
-105
lines changed

7 files changed

+7382
-105
lines changed

__tests__/__snapshots__/index.js.snap

-26
This file was deleted.

__tests__/index.js

+10-63
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,17 @@
11
import React from 'react'
2-
import { configure, mount, shallow } from 'enzyme'
2+
import { mount } from 'enzyme'
3+
34
import Adapter from 'enzyme-adapter-react-16'
45
import EnzymeToJSON from 'enzyme-to-json'
56

7+
import ReactRough from '../src'
8+
69
// Setup Enzyme Adapter
710
configure({ adapter: new Adapter() })
811

9-
import Image from '../src/'
10-
11-
const image =
12-
'https://res.cloudinary.com/stackpie/image/upload/v1513979515/-895520106_m1whb3.jpg'
13-
14-
const placeholder = image.replace('/upload/', '/upload/c_thumb,w_30/')
15-
16-
describe('pimg', () => {
17-
test('renders correctly', () => {
18-
const component = mount(<Image src={image} />)
19-
20-
expect(EnzymeToJSON(component)).toMatchSnapshot()
21-
})
22-
})
23-
24-
describe('Image', () => {
25-
test('generates placeholder when loading', () => {
26-
const component = mount(<Image src={image} />)
27-
28-
if (component.state().loading) {
29-
expect(component.state().placeholder).toBe(placeholder)
30-
}
31-
})
32-
33-
test('src is emptyString if omitted', () => {
34-
const component = mount(<Image/>)
35-
36-
expect(component.props().src).toBe('')
37-
})
38-
39-
test('can take a placeholder prop', () => {
40-
const component = mount(
41-
<Image src={image} placeholder='http://myPlaceholder' />
42-
)
43-
44-
expect(EnzymeToJSON(component)).toMatchSnapshot()
45-
})
46-
47-
test('uses the default classNames when loading', () => {
48-
const component = mount(<Image src={image} />)
49-
50-
if (component.state().loading) {
51-
expect(component.childAt(0).props().className).toBe('pimg pimg__loading')
52-
}
53-
})
54-
55-
test('uses the loadingClassName passed when loading', () => {
56-
const component = mount(<Image className="myImage" loadingClassName="image_is_loading" src={image} />)
57-
58-
if (component.state().loading) {
59-
expect(component.childAt(0).props().className).toBe('myImage image_is_loading')
60-
}
61-
})
62-
63-
test('appends `__loading` if loadingClassName isn\'t passed', () => {
64-
const component = mount(<Image className="myImage" src={image} />)
65-
66-
if (component.state().loading) {
67-
expect(component.childAt(0).props().className).toBe('myImage myImage__loading')
68-
}
69-
})
70-
})
12+
// describe('ReactRough', () => {
13+
// test('renders correctly', () => {
14+
// const component = mount(<ReactRough />)
15+
// expect(EnzymeToJSON(component)).toMatchSnapshot()
16+
// })
17+
// })

examples/basic/index.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ import ReactDOM from 'react-dom'
33
import ReactRough from '../../src'
44

55
const App = () => (
6-
<ReactRough
7-
width="500"
8-
height="200"
9-
render={rc => {
10-
rc.circle(80, 120, 50) // centerX, centerY, diameter
11-
rc.ellipse(300, 100, 150, 80) // centerX, centerY, width, height
12-
rc.line(80, 120, 300, 100) // x1, y1, x2, y2
13-
}}
14-
>
15-
{/* <Circle data={[80, 120, 50]} />
6+
<div>
7+
<ReactRough
8+
width="500"
9+
height="200"
10+
render={rc => {
11+
rc.circle(80, 120, 50) // centerX, centerY, diameter
12+
rc.ellipse(300, 100, 150, 80) // centerX, centerY, width, height
13+
rc.line(80, 120, 300, 100) // x1, y1, x2, y2
14+
}}
15+
>
16+
{/* <Circle data={[80, 120, 50]} />
1617
<Ellipse data={[300, 100, 150, 80]} />
1718
<Line data={[80, 120, 300, 100]} /> */}
18-
</ReactRough>
19+
</ReactRough>
20+
</div>
1921
)
2022

2123
ReactDOM.render(<App />, document.getElementById('root'))

0 commit comments

Comments
 (0)