From c1f04b94952adc2f4d6b32468588039221a0bd57 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Mon, 27 Nov 2017 15:06:30 -0600 Subject: [PATCH] fix snapshot testing with storyshots, enzyme, react-test-renderer Fixes #338 --- src/common/createSlider.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/createSlider.jsx b/src/common/createSlider.jsx index a6d02fd7e..a9cf474e7 100644 --- a/src/common/createSlider.jsx +++ b/src/common/createSlider.jsx @@ -87,7 +87,8 @@ export default function createSlider(Component) { } componentDidMount() { - this.document = this.sliderRef.ownerDocument; + // Snapshot testing cannot handle refs, so be sure to null-check this. + this.document = this.sliderRef && this.sliderRef.ownerDocument; } onMouseDown = (e) => {