From 735b11297c09a9b8ae6e90bc84fd838d92228272 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?=
Date: Thu, 4 Jun 2020 15:06:44 +0200
Subject: [PATCH] fix: should handle zero variants
---
.../update-variant-component-test.jsx.snap | 48 +++----------------
.../variant/update-variant-component.jsx | 2 +-
2 files changed, 7 insertions(+), 43 deletions(-)
diff --git a/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap b/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
index e5f09f8c06..491fde6295 100644
--- a/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
+++ b/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
@@ -177,27 +177,9 @@ exports[`renders correctly with without variants 1`] = `
method in the Client SDK.
-
-
-
-
- Variant name
- |
- |
-
- Weight
- |
- |
-
-
-
-
+
+ No variants defined.
+
method in the Client SDK.
-
-
-
-
- Variant name
- |
- |
-
- Weight
- |
- |
-
-
-
-
+
+ No variants defined.
+
`;
diff --git a/frontend/src/component/feature/variant/update-variant-component.jsx b/frontend/src/component/feature/variant/update-variant-component.jsx
index a777a58ed6..410b2278fb 100644
--- a/frontend/src/component/feature/variant/update-variant-component.jsx
+++ b/frontend/src/component/feature/variant/update-variant-component.jsx
@@ -88,7 +88,7 @@ class UpdateVariantComponent extends Component {
getVariant()
method in the Client SDK.
- {this.renderVariants(variants)}
+ {variants.length > 0 ? this.renderVariants(variants) : No variants defined.
}
{this.props.hasPermission(UPDATE_FEATURE) ? (