Skip to content

Commit 2c5c3de

Browse files
authored
Merge pull request malte-wessel#162 from joscha/patch-1
Support snapshot testing
2 parents 38389aa + 228c5ef commit 2c5c3de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Scrollbars/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export default class Scrollbars extends Component {
200200

201201
addListeners() {
202202
/* istanbul ignore if */
203-
if (typeof document === 'undefined') return;
203+
if (typeof document === 'undefined' || !this.view) return;
204204
const { view, trackHorizontal, trackVertical, thumbHorizontal, thumbVertical } = this;
205205
view.addEventListener('scroll', this.handleScroll);
206206
if (!getScrollbarWidth()) return;
@@ -217,7 +217,7 @@ export default class Scrollbars extends Component {
217217

218218
removeListeners() {
219219
/* istanbul ignore if */
220-
if (typeof document === 'undefined') return;
220+
if (typeof document === 'undefined' || !this.view) return;
221221
const { view, trackHorizontal, trackVertical, thumbHorizontal, thumbVertical } = this;
222222
view.removeEventListener('scroll', this.handleScroll);
223223
if (!getScrollbarWidth()) return;

0 commit comments

Comments
 (0)