File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1138,11 +1138,19 @@ describe('<Waypoint>', function() {
1138
1138
this . parentStyle . height = 'auto' ;
1139
1139
this . parentStyle . overflow = 'visible' ;
1140
1140
1141
+ // This is only here to try and confuse the _findScrollableAncestor code.
1142
+ document . body . style . overflow = 'auto' ;
1143
+
1141
1144
// Make the spacers large enough to make the Waypoint render off-screen
1142
1145
this . topSpacerHeight = window . innerHeight + 1000 ;
1143
1146
this . bottomSpacerHeight = 1000 ;
1144
1147
} ) ;
1145
1148
1149
+ afterEach ( ( ) => {
1150
+ // Reset body style
1151
+ document . body . style . overflow = '' ;
1152
+ } ) ;
1153
+
1146
1154
it ( 'does not fire the onEnter handler on mount' , ( ) => {
1147
1155
this . subject ( ) ;
1148
1156
expect ( this . props . onEnter ) . not . toHaveBeenCalled ( ) ;
Original file line number Diff line number Diff line change @@ -121,14 +121,9 @@ export default class Waypoint extends React.Component {
121
121
while ( node . parentNode ) {
122
122
node = node . parentNode ;
123
123
124
- if ( node === document ) {
125
- // This particular node does not have a computed style.
126
- continue ;
127
- }
128
-
129
- if ( node === document . documentElement ) {
130
- // This particular node does not have a scroll bar, it uses the window.
131
- continue ;
124
+ if ( node === document . body ) {
125
+ // We've reached all the way to the root node.
126
+ return window ;
132
127
}
133
128
134
129
const style = window . getComputedStyle ( node ) ;
You can’t perform that action at this time.
0 commit comments