@@ -4,7 +4,6 @@ import ReactDom from 'react-dom';
44import expect from 'expect.js' ;
55import TestUtils from 'react-dom/test-utils' ;
66import ticker from 'rc-tween-one/lib/ticker' ;
7-
87import ScrollAnim from '../index' ;
98
109const windowHeight = 500 ;
@@ -14,23 +13,25 @@ const endHeight = startHeight + windowHeight;
1413describe ( '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