From e0f3441b9e188797fe19d6e1b0ed8c0f47bbca81 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Thu, 11 Jan 2018 14:13:37 -0500
Subject: [PATCH] Fix NaN in test and update snapshot

---
 src/components/costume-canvas/costume-canvas.jsx            | 4 ++--
 .../__snapshots__/sprite-selector-item.test.jsx.snap        | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/components/costume-canvas/costume-canvas.jsx b/src/components/costume-canvas/costume-canvas.jsx
index 72bccae5e..4375572c1 100644
--- a/src/components/costume-canvas/costume-canvas.jsx
+++ b/src/components/costume-canvas/costume-canvas.jsx
@@ -105,12 +105,12 @@ class CostumeCanvas extends React.Component {
         return (
             <canvas
                 className={this.props.className}
-                height={this.props.height * window.devicePixelRatio}
+                height={this.props.height * (window.devicePixelRatio || 1)}
                 style={{
                     height: `${this.props.height}px`,
                     width: `${this.props.width}px`
                 }}
-                width={this.props.width * window.devicePixelRatio}
+                width={this.props.width * (window.devicePixelRatio || 1)}
                 ref={c => (this.canvas = c)} // eslint-disable-line react/jsx-sort-props
             />
         );
diff --git a/test/unit/components/__snapshots__/sprite-selector-item.test.jsx.snap b/test/unit/components/__snapshots__/sprite-selector-item.test.jsx.snap
index 62c177e38..19abc2a16 100644
--- a/test/unit/components/__snapshots__/sprite-selector-item.test.jsx.snap
+++ b/test/unit/components/__snapshots__/sprite-selector-item.test.jsx.snap
@@ -26,6 +26,12 @@ exports[`SpriteSelectorItemComponent matches snapshot when selected 1`] = `
   <canvas
     className={undefined}
     height={32}
+    style={
+      Object {
+        "height": "32px",
+        "width": "32px",
+      }
+    }
     width={32}
   />
   <div
-- 
GitLab