From daecc7a1288e8affd41837e36fc119ac2887ce4e Mon Sep 17 00:00:00 2001 From: Gabriel L Martinez Date: Fri, 10 Apr 2020 20:27:15 -0400 Subject: [PATCH 1/4] Use isPublished property correctly in Product List --- .../components/ProductList/ProductList.tsx | 9 ++++----- src/products/fixtures.ts | 20 +++++++++++++++++++ src/products/queries.ts | 1 + src/products/types/ProductList.ts | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/products/components/ProductList/ProductList.tsx b/src/products/components/ProductList/ProductList.tsx index dcd7c7add..895194939 100644 --- a/src/products/components/ProductList/ProductList.tsx +++ b/src/products/components/ProductList/ProductList.tsx @@ -105,7 +105,6 @@ interface ProductListProps export const ProductList: React.FC = props => { const { activeAttributeSortId, - settings, disabled, isChecked, @@ -322,13 +321,13 @@ export const ProductList: React.FC = props => { product.isAvailable)} + data-tc-is-published={maybe(() => product.isPublished)} > {product && - maybe(() => product.isAvailable !== undefined) ? ( + maybe(() => product.isPublished !== undefined) ? ( = props => { description: "product status" }) } - status={product.isAvailable ? "success" : "error"} + status={product.isPublished ? "success" : "error"} /> ) : ( diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 2730c64fe..0980e1be6 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -302,6 +302,7 @@ export const products = ( }, id: "UHJvZHVjdDo2MQ==", isAvailable: true, + isPublished: true, name: "Nebula Night Sky Paint", productType: { __typename: "ProductType", @@ -323,6 +324,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NA==", isAvailable: true, + isPublished: true, name: "Light Speed Yellow Paint", productType: { __typename: "ProductType", @@ -344,6 +346,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NQ==", isAvailable: true, + isPublished: true, name: "Hyperspace Turquoise Paint", productType: { __typename: "ProductType", @@ -380,6 +383,7 @@ export const products = ( }, id: "UHJvZHVjdDo3NQ==", isAvailable: true, + isPublished: true, name: "Pineapple Juice", productType: { __typename: "ProductType", @@ -416,6 +420,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Ng==", isAvailable: true, + isPublished: true, name: "Coconut Juice", productType: { __typename: "ProductType", @@ -452,6 +457,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Mg==", isAvailable: true, + isPublished: true, name: "Apple Juice", productType: { __typename: "ProductType", @@ -488,6 +494,7 @@ export const products = ( }, id: "UHJvZHVjdDo3MQ==", isAvailable: true, + isPublished: true, name: "Orange Juice", productType: { __typename: "ProductType", @@ -524,6 +531,7 @@ export const products = ( }, id: "UHJvZHVjdDo3NA==", isAvailable: true, + isPublished: true, name: "Banana Juice", productType: { __typename: "ProductType", @@ -560,6 +568,7 @@ export const products = ( }, id: "UHJvZHVjdDo3OQ==", isAvailable: true, + isPublished: true, name: "Bean Juice", productType: { __typename: "ProductType", @@ -596,6 +605,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Mw==", isAvailable: true, + isPublished: true, name: "Carrot Juice", productType: { __typename: "ProductType", @@ -632,6 +642,7 @@ export const products = ( }, id: "UHJvZHVjdDo3OA==", isAvailable: true, + isPublished: true, name: "Green Juice", productType: { __typename: "ProductType", @@ -668,6 +679,7 @@ export const products = ( }, id: "UHJvZHVjdDo4OQ==", isAvailable: true, + isPublished: true, name: "Code Division T-shirt", productType: { __typename: "ProductType", @@ -704,6 +716,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDc=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -740,6 +753,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDg=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -776,6 +790,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDk=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -812,6 +827,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTA=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -848,6 +864,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTU=", isAvailable: true, + isPublished: true, name: "Black Hoodie", productType: { __typename: "ProductType", @@ -884,6 +901,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTY=", isAvailable: true, + isPublished: true, name: "Blue Hoodie", productType: { __typename: "ProductType", @@ -920,6 +938,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTc=", isAvailable: true, + isPublished: true, name: "Mustard Hoodie", productType: { __typename: "ProductType", @@ -956,6 +975,7 @@ export const products = ( }, id: "UHJvZHVjdDo4NQ==", isAvailable: true, + isPublished: true, name: "Colored Parrot Cushion", productType: { __typename: "ProductType", diff --git a/src/products/queries.ts b/src/products/queries.ts index 99236c111..dbed486ce 100644 --- a/src/products/queries.ts +++ b/src/products/queries.ts @@ -53,6 +53,7 @@ export const productFragment = gql` url } isAvailable + isPublished basePrice { ...Money } diff --git a/src/products/types/ProductList.ts b/src/products/types/ProductList.ts index ab392aa3e..66d7f268b 100644 --- a/src/products/types/ProductList.ts +++ b/src/products/types/ProductList.ts @@ -48,6 +48,7 @@ export interface ProductList_products_edges_node { name: string; thumbnail: ProductList_products_edges_node_thumbnail | null; isAvailable: boolean | null; + isPublished: boolean | null; basePrice: ProductList_products_edges_node_basePrice | null; productType: ProductList_products_edges_node_productType; attributes: ProductList_products_edges_node_attributes[]; From 62ddce81c09d9294ce09b8a12ed40a2ffa1a56fa Mon Sep 17 00:00:00 2001 From: Gabriel L Martinez Date: Fri, 10 Apr 2020 20:35:21 -0400 Subject: [PATCH 2/4] Update CHANGELOG.md to include the fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfcb79337..a270be1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ All notable, unreleased changes to this project will be documented in this file. - Add "Ready to capture" to the "Status" order filter - #430 by @dominik-zeglen - Reset state after closing - #456 by @dominik-zeglen - Password validation errors are not shown - #471 by @gabmartinez +- Display Is Published column correctly in main Product Listing - #475 by @gabmartinez ## 2.0.0 From 7f2361c025eff745d1567723101742365aa3201a Mon Sep 17 00:00:00 2001 From: Gabriel L Martinez Date: Mon, 13 Apr 2020 23:46:40 -0400 Subject: [PATCH 3/4] Add story to test list of products published --- .../__snapshots__/Stories.test.ts.snap | 1701 +++++++++++++++++ .../stories/products/ProductListPage.tsx | 6 + 2 files changed, 1707 insertions(+) diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index ec5bc21de..f9f970796 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -112869,6 +112869,1707 @@ exports[`Storyshots Views / Products / Product list no data 1`] = ` `; +exports[`Storyshots Views / Products / Product list published 1`] = ` +
+
+
+
+ Products +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + Name + +
+ +
+
+
+
+ Type +
+
+
+
+
+ Published +
+
+
+
+
+ Price +
+
+
+
+
+
+
+
+`; + exports[`Storyshots Views / Products / Product variant details attribute errors 1`] = `
)) + .add("published", () => ( + product.isPublished)} + /> + )) .add("no data", () => ); From 910f7210887c70177cd595f84bd7952aa5020e22 Mon Sep 17 00:00:00 2001 From: Gabriel L Martinez Date: Tue, 14 Apr 2020 00:25:31 -0400 Subject: [PATCH 4/4] Add story to test not published list of products Update Stories Snapshot --- src/products/fixtures.ts | 10 +- .../__snapshots__/Stories.test.ts.snap | 1081 +++++++++++------ .../stories/products/ProductListPage.tsx | 6 + 3 files changed, 752 insertions(+), 345 deletions(-) diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 0980e1be6..5f019f4dc 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -324,7 +324,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NA==", isAvailable: true, - isPublished: true, + isPublished: false, name: "Light Speed Yellow Paint", productType: { __typename: "ProductType", @@ -346,7 +346,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NQ==", isAvailable: true, - isPublished: true, + isPublished: false, name: "Hyperspace Turquoise Paint", productType: { __typename: "ProductType", @@ -568,7 +568,7 @@ export const products = ( }, id: "UHJvZHVjdDo3OQ==", isAvailable: true, - isPublished: true, + isPublished: false, name: "Bean Juice", productType: { __typename: "ProductType", @@ -864,7 +864,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTU=", isAvailable: true, - isPublished: true, + isPublished: false, name: "Black Hoodie", productType: { __typename: "ProductType", @@ -975,7 +975,7 @@ export const products = ( }, id: "UHJvZHVjdDo4NQ==", isAvailable: true, - isPublished: true, + isPublished: false, name: "Colored Parrot Cushion", productType: { __typename: "ProductType", diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index f9f970796..ce70250e2 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -110782,12 +110782,12 @@ exports[`Storyshots Views / Products / Product list default 1`] = `
- Published + Not published
- Published + Not published
- Published + Not published
- Published + Not published
- Published + Not published
`; +exports[`Storyshots Views / Products / Product list not published 1`] = ` +
+
+
+
+ Products +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + Name + +
+ +
+
+
+
+ Type +
+
+
+
+
+ Published +
+
+
+
+
+ Price +
+
+
+
+
+
+
+
+`; + exports[`Storyshots Views / Products / Product list published 1`] = `
- - - - - -
-
- -
-
- Light Speed Yellow Paint -
-
- - - Paint - - -
- Published -
- - - $15.00 - - - - - - - -
-
- -
-
- Hyperspace Turquoise Paint -
-
- - - Paint - - -
- Published -
- - - $15.00 - - - - - - - -
-
- -
-
- Bean Juice -
-
- - - Juice - - -
- Published -
- - - $3.00 - - - - - - - -
-
- -
-
- Black Hoodie -
-
- - - Top (clothing) - - -
- Published -
- - - $30.00 - - - - - - - -
-
- -
-
- Colored Parrot Cushion -
-
- - - Cushion - - -
- Published -
- - - $20.00 - -
diff --git a/src/storybook/stories/products/ProductListPage.tsx b/src/storybook/stories/products/ProductListPage.tsx index b8f3f22a6..98ba42fd4 100644 --- a/src/storybook/stories/products/ProductListPage.tsx +++ b/src/storybook/stories/products/ProductListPage.tsx @@ -64,4 +64,10 @@ storiesOf("Views / Products / Product list", module) products={products.filter(product => product.isPublished)} /> )) + .add("not published", () => ( + !product.isPublished)} + /> + )) .add("no data", () => );