1+ /* eslint require-jsdoc: 0 */
2+ /* eslint max-len: 0 */
13import React from 'react' ;
24import ReactTestUtils from 'react-dom/test-utils' ;
35import { configure , mount } from 'enzyme' ;
@@ -8,16 +10,16 @@ import PlaceholderWithoutTracking from './PlaceholderWithoutTracking.jsx';
810configure ( { adapter : new Adapter ( ) } ) ;
911
1012const {
11- scryRenderedDOMComponentsWithTag
13+ scryRenderedDOMComponentsWithTag,
1214} = ReactTestUtils ;
1315
1416describe ( 'PlaceholderWithoutTracking' , function ( ) {
1517 function renderPlaceholderWithoutTracking ( {
16- onVisible = ( ) => null ,
17- placeholder = null ,
18- scrollPosition = { x : 0 , y : 0 } ,
19- style = { }
20- } = { } ) {
18+ onVisible = ( ) => null ,
19+ placeholder = null ,
20+ scrollPosition = { x : 0 , y : 0 } ,
21+ style = { } ,
22+ } = { } ) {
2123 return mount (
2224 < PlaceholderWithoutTracking
2325 onVisible = { onVisible }
@@ -38,13 +40,13 @@ describe('PlaceholderWithoutTracking', function() {
3840 left : - offsetX ,
3941 right : - offsetX ,
4042 top : - offsetY ,
41- width : 0
43+ width : 0 ,
4244 } ) ;
4345
4446 component . instance ( ) . placeholder . getBoundingClientRect = myMock ;
4547
4648 component . setProps ( {
47- scrollPosition : { x : offsetX , y : offsetY }
49+ scrollPosition : { x : offsetX , y : offsetY } ,
4850 } ) ;
4951 }
5052
@@ -62,21 +64,21 @@ describe('PlaceholderWithoutTracking', function() {
6264
6365 it ( 'renders the default placeholder when it\'s not in the viewport' , function ( ) {
6466 const component = renderPlaceholderWithoutTracking ( {
65- style : { marginTop : 100000 }
67+ style : { marginTop : 100000 } ,
6668 } ) ;
6769
6870 expectParagraphs ( component , 0 ) ;
6971 expectPlaceholders ( component , 1 ) ;
7072 } ) ;
7173
7274 it ( 'renders the prop placeholder when it\'s not in the viewport' , function ( ) {
73- const style = { marginTop : 100000 } ;
75+ const style = { marginTop : 100000 } ;
7476 const placeholder = (
7577 < strong style = { style } > </ strong >
7678 ) ;
7779 const component = renderPlaceholderWithoutTracking ( {
7880 placeholder,
79- style
81+ style,
8082 } ) ;
8183
8284 expectParagraphs ( component , 0 ) ;
@@ -87,7 +89,7 @@ describe('PlaceholderWithoutTracking', function() {
8789 const onVisible = jest . fn ( ) ;
8890 const component = renderPlaceholderWithoutTracking ( {
8991 onVisible,
90- style : { marginTop : 100000 }
92+ style : { marginTop : 100000 } ,
9193 } ) ;
9294
9395 expect ( onVisible ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -96,7 +98,7 @@ describe('PlaceholderWithoutTracking', function() {
9698 it ( 'triggers onVisible when the image is in the viewport' , function ( ) {
9799 const onVisible = jest . fn ( ) ;
98100 const component = renderPlaceholderWithoutTracking ( {
99- onVisible
101+ onVisible,
100102 } ) ;
101103
102104 expect ( onVisible ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -107,7 +109,7 @@ describe('PlaceholderWithoutTracking', function() {
107109 const offset = 100000 ;
108110 const component = renderPlaceholderWithoutTracking ( {
109111 onVisible,
110- style : { marginTop : offset }
112+ style : { marginTop : offset } ,
111113 } ) ;
112114
113115 simulateScroll ( component , 0 , offset ) ;
@@ -120,10 +122,10 @@ describe('PlaceholderWithoutTracking', function() {
120122 const offset = 100000 ;
121123 const component = renderPlaceholderWithoutTracking ( {
122124 onVisible,
123- style : { marginLeft : offset }
125+ style : { marginLeft : offset } ,
124126 } ) ;
125127
126- simulateScroll ( component , offset , 0 ) ;
128+ simulateScroll ( component , offset , 0 ) ;
127129
128130 expect ( onVisible ) . toHaveBeenCalledTimes ( 1 ) ;
129131 } ) ;
0 commit comments