From c4c9895a56c85a41ff76403e40208f110520d5c0 Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Thu, 2 Jul 2020 16:32:38 +0200 Subject: [PATCH] Create story for invoice list --- .../OrderInvoiceList/OrderInvoiceList.tsx | 2 +- src/orders/fixtures.ts | 40 +++ .../__snapshots__/Stories.test.ts.snap | 280 ++++++++++++++++++ src/storybook/config.js | 1 + .../stories/orders/OrderInvoiceList.tsx | 23 ++ 5 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 src/storybook/stories/orders/OrderInvoiceList.tsx diff --git a/src/orders/components/OrderInvoiceList/OrderInvoiceList.tsx b/src/orders/components/OrderInvoiceList/OrderInvoiceList.tsx index ced7044cf..c648e1535 100644 --- a/src/orders/components/OrderInvoiceList/OrderInvoiceList.tsx +++ b/src/orders/components/OrderInvoiceList/OrderInvoiceList.tsx @@ -35,7 +35,7 @@ const useStyles = makeStyles( { name: "OrderInvoiceList" } ); -interface OrderInvoiceListProps { +export interface OrderInvoiceListProps { invoices: InvoiceFragment[]; onInvoiceGenerate: () => void; onInvoiceClick: (invoiceId: string) => void; diff --git a/src/orders/fixtures.ts b/src/orders/fixtures.ts index 6d5fc77d5..006e61c84 100644 --- a/src/orders/fixtures.ts +++ b/src/orders/fixtures.ts @@ -11,6 +11,7 @@ import { OrderStatus, PaymentChargeStatusEnum } from "../types/globalTypes"; +import { InvoiceFragment } from "./types/InvoiceFragment"; import { OrderDetails_order } from "./types/OrderDetails"; import { OrderList_orders_edges_node } from "./types/OrderList"; import { SearchOrderVariant_search_edges_node } from "./types/SearchOrderVariant"; @@ -1319,3 +1320,42 @@ export const orderLineSearch = ( ] } ]; + +export const invoices: InvoiceFragment[] = [ + { + __typename: "Invoice", + createdAt: "2020-07-02T12:13:56.901097+00:00", + id: "SW52b2ljZTo0", + number: "1/07/2020", + status: JobStatusEnum.PENDING, + url: + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-1fef611b-7514-4dc6-aee3-09a8232b1d6a.pdf" + }, + { + __typename: "Invoice", + createdAt: "2020-07-02T09:06:17.059412+00:00", + id: "SW52b2ljZToz", + number: "1/07/2020", + status: JobStatusEnum.SUCCESS, + url: + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-8df26967-ad21-4075-a446-cef44ae05197.pdf" + }, + { + __typename: "Invoice", + createdAt: "2020-07-02T09:05:58.300952+00:00", + id: "SW52b2ljZToy", + number: "1/07/2020", + status: JobStatusEnum.SUCCESS, + url: + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-5ebc85e0-e587-4386-8292-9b85839281e6.pdf" + }, + { + __typename: "Invoice", + createdAt: "2020-07-02T09:04:27.257562+00:00", + id: "SW52b2ljZTox", + number: "1/07/2020", + status: JobStatusEnum.SUCCESS, + url: + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-0e449e10-ef4b-4066-bebe-361f670b6820.pdf" + } +]; diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 898570aa9..5ddcebafd 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -9331,6 +9331,286 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` `; +exports[`Storyshots Orders / OrderInvoiceList loading 1`] = ` +
+
+
+ + Invoices + +
+ +
+
+
+
+
+ + ‌ + +
+
+
+`; + +exports[`Storyshots Orders / OrderInvoiceList with invoices 1`] = ` +
+
+
+ + Invoices + +
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+ Invoice no +
+
+
+
+
+ Action +
+
+
+ Invoice 1/07/2020 +
+ created Jul 2, 2020 +
+
+ +
+ Invoice 1/07/2020 +
+ created Jul 2, 2020 +
+
+ +
+ Invoice 1/07/2020 +
+ created Jul 2, 2020 +
+
+ +
+
+
+
+
+`; + +exports[`Storyshots Orders / OrderInvoiceList without invoices 1`] = ` +
+
+
+ + Invoices + +
+ +
+
+
+
+
+
+ No invoices to be shown +
+
+
+
+`; + exports[`Storyshots Orders / OrderMarkAsPaidDialog default 1`] = `
undefined, + onInvoiceGenerate: () => undefined, + onInvoiceSend: () => undefined +}; + +storiesOf("Orders / OrderInvoiceList", module) + .addDecorator(Decorator) + .add("with invoices", () => ( + + )) + .add("without invoices", () => ) + .add("loading", () => );