|
1 | 1 | import React from 'react'
|
2 |
| -import { configure, mount, shallow } from 'enzyme' |
| 2 | +import { mount } from 'enzyme' |
| 3 | + |
3 | 4 | import Adapter from 'enzyme-adapter-react-16'
|
4 | 5 | import EnzymeToJSON from 'enzyme-to-json'
|
5 | 6 |
|
| 7 | +import ReactRough from '../src' |
| 8 | + |
6 | 9 | // Setup Enzyme Adapter
|
7 | 10 | configure({ adapter: new Adapter() })
|
8 | 11 |
|
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 | +// }) |
0 commit comments