Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add tests

dominik-zeglen0413ea41bbc2
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
index bea9d935d8..d01c3df0cc 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
@@ -1,30 +1,13 @@
import { storiesOf } from "@storybook/react";
import React from "react";
+import { formError } from "@saleor/storybook/misc";
import placeholderImage from "../../../../images/placeholder255x255.png";
import ProductVariantCreatePage from "../../../products/components/ProductVariantCreatePage";
import { product as productFixture } from "../../../products/fixtures";
import Decorator from "../../Decorator";
const product = productFixture(placeholderImage);
-const errors = [
- {
- field: "cost_price",
- message: "Generic error"
- },
- {
- field: "price_override",
- message: "Generic error"
- },
- {
- field: "sku",
- message: "Generic error"
- },
- {
- field: "stock",
- message: "Generic error"
- }
-];
storiesOf("Views / Products / Create product variant", module)
.addDecorator(Decorator)
@@ -44,7 +27,7 @@ storiesOf("Views / Products / Create product variant", module)
.add("with errors", () => (
<ProductVariantCreatePage
currencySymbol="USD"
- errors={errors}
+ errors={[formError("attributes:color")]}
header="Add variant"
loading={false}
product={product}
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
index 3404ae43ad..226c9ad383 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
@@ -1,6 +1,7 @@
import { storiesOf } from "@storybook/react";
import React from "react";
+import { formError } from "@saleor/storybook/misc";
import placeholderImage from "../../../../images/placeholder60x60.png";
import ProductVariantPage from "../../../products/components/ProductVariantPage";
import { variant as variantFixture } from "../../../products/fixtures";
@@ -38,4 +39,18 @@ storiesOf("Views / Products / Product variant details", module)
onVariantClick={() => undefined}
saveButtonBarState="default"
/>
+ ))
+ .add("attribute errors", () => (
+ <ProductVariantPage
+ header={variant.name || variant.sku}
+ variant={variant}
+ onAdd={() => undefined}
+ onBack={() => undefined}
+ onDelete={undefined}
+ onImageSelect={() => undefined}
+ onSubmit={() => undefined}
+ onVariantClick={() => undefined}
+ saveButtonBarState="default"
+ errors={["attributes:Borders", "attributes:Legacy"].map(formError)}
+ />
));