Skip to content

Commit 2b43dbe

Browse files
committed
fix parallax test
1 parent 40c2f0b commit 2b43dbe

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

tests/parallax.spec.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import ReactDom from 'react-dom';
44
import expect from 'expect.js';
55
import TestUtils from 'react-dom/test-utils';
66
import ticker from 'rc-tween-one/lib/ticker';
7-
87
import ScrollAnim from '../index';
98

109
const windowHeight = 500;
@@ -14,23 +13,25 @@ const endHeight = startHeight + windowHeight;
1413
describe('rc-scroll-anim', () => {
1514
let div;
1615
let instance;
17-
function createScrollParallax(cProps) {
18-
function ParallaxDemo (props) {
19-
return (<div
20-
style={{ height: 500, overflow: 'scroll', position: 'absolute', width: '100%', top: 0 }}
21-
id="c-div"
22-
>
23-
<div style={{ height: 1000 }} />
24-
<div style={{ height: 1000 }}>
16+
function createScrollParallax(props) {
17+
class ParallaxDemo extends React.PureComponent {
18+
render() {
19+
return (<div
20+
style={{ height: 500, overflow: 'scroll', position: 'absolute', width: '100%', top: 0 }}
21+
id="c-div"
22+
>
23+
<div style={{ height: 1000 }} />
24+
<div style={{ height: 1000 }}>
2525
-------------
26-
<ScrollAnim.Parallax {...props} targetId="c-div">
26+
<ScrollAnim.Parallax {...this.props} targetId="c-div">
2727
demo
28-
</ScrollAnim.Parallax>
28+
</ScrollAnim.Parallax>
2929
-------------
30-
</div>
31-
</div>);
30+
</div>
31+
</div>);
32+
}
3233
}
33-
return ReactDom.render(<ParallaxDemo {...cProps} />, div);
34+
return ReactDom.render(<ParallaxDemo {...props} />, div);
3435
}
3536

3637
beforeEach(() => {
@@ -103,4 +104,4 @@ describe('rc-scroll-anim', () => {
103104
}, 350);
104105
}, 350);
105106
});
106-
});
107+
});

0 commit comments

Comments
 (0)