Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make components self-contained
Patryk Zawadzkibf0caafbde01
diff --git a/package.json b/package.jsonindex b31260656f..ec8a7780e2 100644--- a/package.json+++ b/package.json@@ -131,7 +131,7 @@"transform": {"^.+\\.tsx?$": "ts-jest"},- "testRegex": "(/__tests__/.*(test|spec))\\.(jsx?|tsx?)$",+ "testRegex": ".*\\.test\\.tsx?$","moduleFileExtensions": ["ts","tsx",diff --git a/saleor/static/dashboard-next/js/__tests__/components/fixtures/category.ts b/saleor/static/dashboard-next/js/__tests__/components/fixtures/category.tsdeleted file mode 100644index ca242866f0..0000000000--- a/saleor/static/dashboard-next/js/__tests__/components/fixtures/category.ts+++ /dev/null@@ -1,8 +0,0 @@-export default {- node: {- description:- "Girl remain increase quite. More opportunity special special life foot employee. Wall employee all relate control cause need.",- id: "Q2F0ZWdvcnk6NA==",- name: "Books"- }-};diff --git a/saleor/static/dashboard-next/js/__tests__/components/fixtures/categoryList.ts b/saleor/static/dashboard-next/js/__tests__/components/fixtures/categoryList.tsdeleted file mode 100644index 9a10f8e4ef..0000000000--- a/saleor/static/dashboard-next/js/__tests__/components/fixtures/categoryList.ts+++ /dev/null@@ -1,26 +0,0 @@-export default [- {- node: {- id: "Q2F0ZWdvcnk6MQ==",- name: "Apparel"- }- },- {- node: {- id: "Q2F0ZWdvcnk6Mg==",- name: "Accessories"- }- },- {- node: {- id: "Q2F0ZWdvcnk6Mw==",- name: "Groceries"- }- },- {- node: {- id: "Q2F0ZWdvcnk6NA==",- name: "Books"- }- }-];diff --git a/saleor/static/dashboard-next/js/__tests__/components/fixtures/errorMessage.ts b/saleor/static/dashboard-next/js/__tests__/components/fixtures/errorMessage.tsdeleted file mode 100644index da37c18376..0000000000--- a/saleor/static/dashboard-next/js/__tests__/components/fixtures/errorMessage.ts+++ /dev/null@@ -1 +0,0 @@-export default "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eget pulvinar purus. Etiam nisl orci, maximus dictum elit vitae, tincidunt scelerisque lacus. Nam sed sem nec arcu gravida facilisis a a nisl. Donec ac orci mollis, porta ligula et, facilisis ipsum. Curabitur ut lacus nisi. Sed dui sapien, lobortis in quam at, vestibulum eleifend dolor.";diff --git a/saleor/static/dashboard-next/js/__tests__/components/fixtures/product.ts b/saleor/static/dashboard-next/js/__tests__/components/fixtures/product.tsdeleted file mode 100644index 8c440a69df..0000000000--- a/saleor/static/dashboard-next/js/__tests__/components/fixtures/product.ts+++ /dev/null@@ -1,12 +0,0 @@-export default {- cursor: "YXJyYXljb25uZWN0aW9uOjA=",- node: {- id: "UHJvZHVjdDox",- name: "Lewis PLC",- price: {- localized: "62,43 USD"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_ZoF6Xi8-crop-c0-5__0-5-255x255-70.jpg"- }-};diff --git a/saleor/static/dashboard-next/js/__tests__/components/fixtures/productList.ts b/saleor/static/dashboard-next/js/__tests__/components/fixtures/productList.tsdeleted file mode 100644index ad98b35a0e..0000000000--- a/saleor/static/dashboard-next/js/__tests__/components/fixtures/productList.ts+++ /dev/null@@ -1,132 +0,0 @@-export default [- {- cursor: "YXJyYXljb25uZWN0aW9uOjA=",- node: {- id: "UHJvZHVjdDox",- name: "Lewis PLC",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_ZoF6Xi8-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjE=",- node: {- id: "UHJvZHVjdDoy",- name: "Kennedy-Ramirez",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_07Fa6v8-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjI=",- node: {- id: "UHJvZHVjdDoz",- name: "Newman, Ashley and Roberson",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_zeczDly-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjM=",- node: {- id: "UHJvZHVjdDo0",- name: "Jacobson, Stewart and Rodriguez",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_VX2ikxl-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjQ=",- node: {- id: "UHJvZHVjdDo1",- name: "Sloan Ltd",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_wl4FUo7-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjU=",- node: {- id: "UHJvZHVjdDo2",- name: "Foster-Beard",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_c0nSiAe-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjY=",- node: {- id: "UHJvZHVjdDo3",- name: "Henson PLC",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_qHI83dZ-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjc=",- node: {- id: "UHJvZHVjdDo4",- name: "Novak, Lopez and Cook",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_06TblXK-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjg=",- node: {- id: "UHJvZHVjdDo5",- name: "Thompson-Jones",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_yMYqzTc-crop-c0-5__0-5-255x255-70.jpg"- }- },- {- cursor: "YXJyYXljb25uZWN0aW9uOjk=",- node: {- id: "UHJvZHVjdDoxMA==",- name: "Cunningham, Torres and Day",- productType: {- id: "123412341234",- name: "T-sirts"- },- thumbnailUrl:- "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_eWtYYcz-crop-c0-5__0-5-255x255-70.jpg"- }- }-];diff --git a/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx b/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsxindex 68b1656b30..f69c67edd2 100644--- a/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx+++ b/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx@@ -58,7 +58,9 @@ const CategoryProducts: React.StatelessComponent<CategoryProductsProps> = ({onNextPage={onNextPage}onPreviousPage={onPreviousPage}products={- data.category && data.category.products && data.category.products.edges+ data.category &&+ data.category.products &&+ data.category.products.edges.map(edge => edge.node)}/></Card>diff --git a/saleor/static/dashboard-next/js/category/views/details.tsx b/saleor/static/dashboard-next/js/category/views/details.tsxindex 72c2941335..eabbcf69fe 100644--- a/saleor/static/dashboard-next/js/category/views/details.tsx+++ b/saleor/static/dashboard-next/js/category/views/details.tsx@@ -6,13 +6,13 @@ import { stringify as stringifyQs } from "qs";import * as React from "react";import { Redirect } from "react-router-dom";+import CategoryPropertiesCard from "../../components/CategoryPropertiesCard";import ErrorMessageCard from "../../components/ErrorMessageCard";import Navigator, { NavigatorLink } from "../../components/Navigator";import Toggle from "../../components/Toggle";import { CategoryPropertiesQuery } from "../../gql-types";import CategoryDeleteDialog from "../components/CategoryDeleteDialog";import CategoryProducts from "../components/CategoryProducts";-import CategoryProperties from "../components/CategoryProperties";import CategorySubcategories from "../components/CategorySubcategories";import ProductFilters from "../components/ProductFilters";import RootCategoryList from "../components/RootCategoryList";@@ -225,7 +225,7 @@ const CategoryDetails = decorate<CategoryDetailsProps>(>{handleEdit => (<>- <CategoryProperties+ <CategoryPropertiesCarddescription={data.category &&data.category.descriptiondiff --git a/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx b/saleor/static/dashboard-next/js/components/CategoryList/CategoryList.test.tsxsimilarity index 66%rename from saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsxrename to saleor/static/dashboard-next/js/components/CategoryList/CategoryList.test.tsxindex 525cd1375f..0d5f0cab4d 100644--- a/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx+++ b/saleor/static/dashboard-next/js/components/CategoryList/CategoryList.test.tsx@@ -2,8 +2,34 @@ import * as React from "react";import { MemoryRouter } from "react-router-dom";import * as renderer from "react-test-renderer";-import CategoryList from "../../components/CategoryList";-import categoryListFixture from "./fixtures/categoryList";+import CategoryList from "./CategoryList";++const categories = [+ {+ node: {+ id: "cat1",+ name: "Apparel"+ }+ },+ {+ node: {+ id: "cat2",+ name: "Accessories"+ }+ },+ {+ node: {+ id: "cat3",+ name: "Groceries"+ }+ },+ {+ node: {+ id: "cat4",+ name: "Books"+ }+ }+];describe("<CategoryList />", () => {it("renders while data is loading", () => {@@ -17,7 +43,7 @@ describe("<CategoryList />", () => {it("renders when data is fully loaded", () => {const component = renderer.create(<MemoryRouter>- <CategoryList categories={categoryListFixture} onClick={jest.fn()} />+ <CategoryList categories={categories} onClick={jest.fn()} /></MemoryRouter>);expect(component).toMatchSnapshot();diff --git a/saleor/static/dashboard-next/js/components/CategoryList.tsx b/saleor/static/dashboard-next/js/components/CategoryList/CategoryList.tsxsimilarity index 90%rename from saleor/static/dashboard-next/js/components/CategoryList.tsxrename to saleor/static/dashboard-next/js/components/CategoryList/CategoryList.tsxindex 9c8db12148..b5d622a787 100644--- a/saleor/static/dashboard-next/js/components/CategoryList.tsx+++ b/saleor/static/dashboard-next/js/components/CategoryList/CategoryList.tsx@@ -7,9 +7,9 @@ import List, {} from "material-ui/List";import * as React from "react";-import { CategoryPropertiesQuery } from "../gql-types";-import i18n from "../i18n";-import Skeleton from "./Skeleton";+import { CategoryPropertiesQuery } from "../../gql-types";+import i18n from "../../i18n";+import Skeleton from "../Skeleton";interface CategoryListProps {categories?: CategoryPropertiesQuery["category"]["children"]["edges"];diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/CategoryList.test.tsx.snap b/saleor/static/dashboard-next/js/components/CategoryList/__snapshots__/CategoryList.test.tsx.snapsimilarity index 100%rename from saleor/static/dashboard-next/js/__tests__/components/__snapshots__/CategoryList.test.tsx.snaprename to saleor/static/dashboard-next/js/components/CategoryList/__snapshots__/CategoryList.test.tsx.snapdiff --git a/saleor/static/dashboard-next/js/components/CategoryList/index.ts b/saleor/static/dashboard-next/js/components/CategoryList/index.tsnew file mode 100644index 0000000000..9bf9d53a27--- /dev/null+++ b/saleor/static/dashboard-next/js/components/CategoryList/index.ts@@ -0,0 +1 @@+export { default } from "./CategoryList";diff --git a/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/CategoryPropertiesCard.test.tsxsimilarity index 60%rename from saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsxrename to saleor/static/dashboard-next/js/components/CategoryPropertiesCard/CategoryPropertiesCard.test.tsxindex b0b02f055b..00a59edc34 100644--- a/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx+++ b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/CategoryPropertiesCard.test.tsx@@ -2,14 +2,13 @@ import * as React from "react";import { MemoryRouter } from "react-router-dom";import * as renderer from "react-test-renderer";-import CategoryProperties from "../../category/components/CategoryProperties";-import categoryFixture from "./fixtures/category";+import CategoryPropertiesCard from "./CategoryPropertiesCard";-describe("<CategoryProperties />", () => {+describe("<CategoryPropertiesCard />", () => {it("renders while data is loading", () => {const component = renderer.create(<MemoryRouter>- <CategoryProperties description="" onDelete={jest.fn()} title="" />+ <CategoryPropertiesCard description="" onDelete={jest.fn()} title="" /></MemoryRouter>);expect(component).toMatchSnapshot();@@ -17,11 +16,11 @@ describe("<CategoryProperties />", () => {it("renders when data is loaded", () => {const component = renderer.create(<MemoryRouter>- <CategoryProperties- description={categoryFixture.node.description}+ <CategoryPropertiesCard+ description="These are the best shoes."onDelete={jest.fn()}onEdit={jest.fn()}- title={categoryFixture.node.name}+ title="Shoes"/></MemoryRouter>);diff --git a/saleor/static/dashboard-next/js/category/components/CategoryProperties.tsx b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/CategoryPropertiesCard.tsxsimilarity index 100%rename from saleor/static/dashboard-next/js/category/components/CategoryProperties.tsxrename to saleor/static/dashboard-next/js/components/CategoryPropertiesCard/CategoryPropertiesCard.tsxdiff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/CategoryProperties.test.tsx.snap b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/__snapshots__/CategoryPropertiesCard.test.tsx.snapsimilarity index 94%rename from saleor/static/dashboard-next/js/__tests__/components/__snapshots__/CategoryProperties.test.tsx.snaprename to saleor/static/dashboard-next/js/components/CategoryPropertiesCard/__snapshots__/CategoryPropertiesCard.test.tsx.snapindex ab0a0409e1..6fbe1e3f1f 100644--- a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/CategoryProperties.test.tsx.snap+++ b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/__snapshots__/CategoryPropertiesCard.test.tsx.snap@@ -1,6 +1,6 @@// Jest Snapshot v1, https://goo.gl/fbAQLP-exports[`<CategoryProperties /> renders when data is loaded 1`] = `+exports[`<CategoryPropertiesCard /> renders when data is loaded 1`] = `<divclassName="MuiPaper-root-1 MuiPaper-elevation2-5 MuiPaper-rounded-2">@@ -10,7 +10,7 @@ exports[`<CategoryProperties /> renders when data is loaded 1`] = `<h2className="MuiTypography-root-34 MuiTypography-title-40 Component-title-33">- Books+ Shoes</h2><divclassName="Component-action-28"@@ -95,13 +95,13 @@ exports[`<CategoryProperties /> renders when data is loaded 1`] = `<pclassName="MuiTypography-root-34 MuiTypography-body1-43">- Girl remain increase quite. More opportunity special special life foot employee. Wall employee all relate control cause need.+ These are the best shoes.</p></div></div>`;-exports[`<CategoryProperties /> renders while data is loading 1`] = `+exports[`<CategoryPropertiesCard /> renders while data is loading 1`] = `<divclassName="MuiPaper-root-1 MuiPaper-elevation2-5 MuiPaper-rounded-2">diff --git a/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/index.ts b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/index.tsnew file mode 100644index 0000000000..eea396de7b--- /dev/null+++ b/saleor/static/dashboard-next/js/components/CategoryPropertiesCard/index.ts@@ -0,0 +1 @@+export { default } from "./CategoryPropertiesCard";diff --git a/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx b/saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.test.tsxsimilarity index 58%rename from saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsxrename to saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.test.tsxindex 85dd677f80..9f81a8f7e0 100644--- a/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx+++ b/saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.test.tsx@@ -1,13 +1,12 @@import * as React from "react";import * as renderer from "react-test-renderer";-import ErrorMessageCard from "../../components/ErrorMessageCard";-import errorMessageFixture from "./fixtures/errorMessage";+import ErrorMessageCard from "./ErrorMessageCard";describe("<ErrorMessageCard />", () => {it("renders properly", () => {const component = renderer.create(- <ErrorMessageCard message={errorMessageFixture} />+ <ErrorMessageCard message="Things are terrible." />);expect(component).toMatchSnapshot();});diff --git a/saleor/static/dashboard-next/js/components/ErrorMessageCard.tsx b/saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.tsxsimilarity index 94%rename from saleor/static/dashboard-next/js/components/ErrorMessageCard.tsxrename to saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.tsxindex 303db7827f..15d628935c 100644--- a/saleor/static/dashboard-next/js/components/ErrorMessageCard.tsx+++ b/saleor/static/dashboard-next/js/components/ErrorMessageCard/ErrorMessageCard.tsx@@ -2,7 +2,7 @@ import Card, { CardContent } from "material-ui/Card";import Typography from "material-ui/Typography";import * as React from "react";-import i18n from "../i18n";+import i18n from "../../i18n";interface ErrorMessageCardProps {message: string;diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap b/saleor/static/dashboard-next/js/components/ErrorMessageCard/__snapshots__/ErrorMessageCard.test.tsx.snapsimilarity index 54%rename from saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snaprename to saleor/static/dashboard-next/js/components/ErrorMessageCard/__snapshots__/ErrorMessageCard.test.tsx.snapindex 2c12ca9a67..ae83a22f96 100644--- a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap+++ b/saleor/static/dashboard-next/js/components/ErrorMessageCard/__snapshots__/ErrorMessageCard.test.tsx.snap@@ -15,7 +15,7 @@ exports[`<ErrorMessageCard /> renders properly 1`] = `<pclassName="MuiTypography-root-29 MuiTypography-body1-38">- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eget pulvinar purus. Etiam nisl orci, maximus dictum elit vitae, tincidunt scelerisque lacus. Nam sed sem nec arcu gravida facilisis a a nisl. Donec ac orci mollis, porta ligula et, facilisis ipsum. Curabitur ut lacus nisi. Sed dui sapien, lobortis in quam at, vestibulum eleifend dolor.+ Things are terrible.</p></div></div>diff --git a/saleor/static/dashboard-next/js/components/ErrorMessageCard/index.ts b/saleor/static/dashboard-next/js/components/ErrorMessageCard/index.tsnew file mode 100644index 0000000000..e5e67e8be8--- /dev/null+++ b/saleor/static/dashboard-next/js/components/ErrorMessageCard/index.ts@@ -0,0 +1 @@+export { default } from "./ErrorMessageCard";diff --git a/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx b/saleor/static/dashboard-next/js/components/FilterCard/FilterCard.test.tsxsimilarity index 83%rename from saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsxrename to saleor/static/dashboard-next/js/components/FilterCard/FilterCard.test.tsxindex 7d5d58cd95..c75cedcda1 100644--- a/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx+++ b/saleor/static/dashboard-next/js/components/FilterCard/FilterCard.test.tsx@@ -1,7 +1,7 @@import * as React from "react";import * as renderer from "react-test-renderer";-import FilterCard from "../../components/FilterCard";+import FilterCard from "./FilterCard";describe("<FilterCard />", () => {it("renders properly", () => {diff --git a/saleor/static/dashboard-next/js/components/FilterCard.tsx b/saleor/static/dashboard-next/js/components/FilterCard/FilterCard.tsxsimilarity index 95%rename from saleor/static/dashboard-next/js/components/FilterCard.tsxrename to saleor/static/dashboard-next/js/components/FilterCard/FilterCard.tsxindex 28d359a92e..642f6b6161 100644--- a/saleor/static/dashboard-next/js/components/FilterCard.tsx+++ b/saleor/static/dashboard-next/js/components/FilterCard/FilterCard.tsx@@ -3,7 +3,7 @@ import Card, { CardContent, CardHeader } from "material-ui/Card";import IconButton from "material-ui/IconButton";import * as React from "react";-import i18n from "../i18n";+import i18n from "../../i18n";export interface FilterCardProps {handleClear();diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snap b/saleor/static/dashboard-next/js/components/FilterCard/__snapshots__/FilterCard.test.tsx.snapsimilarity index 100%rename from saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snaprename to saleor/static/dashboard-next/js/components/FilterCard/__snapshots__/FilterCard.test.tsx.snapdiff --git a/saleor/static/dashboard-next/js/components/FilterCard/index.ts b/saleor/static/dashboard-next/js/components/FilterCard/index.tsnew file mode 100644index 0000000000..f9e07b97da--- /dev/null+++ b/saleor/static/dashboard-next/js/components/FilterCard/index.ts@@ -0,0 +1 @@+export { default } from "./FilterCard";diff --git a/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx b/saleor/static/dashboard-next/js/components/ProductList/ProductList.test.tsxsimilarity index 62%rename from saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsxrename to saleor/static/dashboard-next/js/components/ProductList/ProductList.test.tsxindex 2dd3df7650..788ac0993b 100644--- a/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx+++ b/saleor/static/dashboard-next/js/components/ProductList/ProductList.test.tsx@@ -2,8 +2,40 @@ import * as React from "react";import { MemoryRouter } from "react-router-dom";import * as renderer from "react-test-renderer";-import ProductList from "../../components/ProductList";-import productListFixture from "./fixtures/productList";+import ProductList from "./ProductList";++const products = [+ {+ id: "prod1",+ name: "Lewis PLC",+ productType: {+ id: "123412341234",+ name: "T-sirts"+ },+ thumbnailUrl:+ "/media/__sized__/products/saleor/static/placeholders/t-shirts/5_ZoF6Xi8-crop-c0-5__0-5-255x255-70.jpg"+ },+ {+ id: "prod2",+ name: "Kennedy-Ramirez",+ productType: {+ id: "123412341234",+ name: "T-sirts"+ },+ thumbnailUrl:+ "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_07Fa6v8-crop-c0-5__0-5-255x255-70.jpg"+ },+ {+ id: "prod3",+ name: "Newman, Ashley and Roberson",+ productType: {+ id: "123412341234",+ name: "T-sirts"+ },+ thumbnailUrl:+ "/media/__sized__/products/saleor/static/placeholders/t-shirts/6_zeczDly-crop-c0-5__0-5-255x255-70.jpg"+ }+];describe("<ProductList />", () => {it("renders while data is loading", () => {@@ -25,7 +57,7 @@ describe("<ProductList />", () => {hasNextPage={false}onNextPage={jest.fn()}onPreviousPage={jest.fn()}- products={productListFixture}+ products={products}/></MemoryRouter>);@@ -38,7 +70,7 @@ describe("<ProductList />", () => {hasNextPage={true}onNextPage={jest.fn()}onPreviousPage={jest.fn()}- products={productListFixture}+ products={products}/></MemoryRouter>);diff --git a/saleor/static/dashboard-next/js/components/ProductList.tsx b/saleor/static/dashboard-next/js/components/ProductList/ProductList.tsxsimilarity index 79%rename from saleor/static/dashboard-next/js/components/ProductList.tsxrename to saleor/static/dashboard-next/js/components/ProductList/ProductList.tsxindex 49b8ede890..0f7a838637 100644--- a/saleor/static/dashboard-next/js/components/ProductList.tsx+++ b/saleor/static/dashboard-next/js/components/ProductList/ProductList.tsx@@ -10,10 +10,10 @@ import Table, {} from "material-ui/Table";import * as React from "react";-import { CategoryPropertiesQuery } from "../gql-types";-import i18n from "../i18n";-import Skeleton from "./Skeleton";-import TablePagination from "./TablePagination";+import { CategoryPropertiesQuery } from "../../gql-types";+import i18n from "../../i18n";+import Skeleton from "../Skeleton";+import TablePagination from "../TablePagination";const decorate = withStyles(theme => ({avatarCell: {@@ -26,7 +26,14 @@ const decorate = withStyles(theme => ({interface ProductListProps {hasNextPage?: boolean;hasPreviousPage?: boolean;- products?: CategoryPropertiesQuery["category"]["products"]["edges"];+ products?: Array<{+ id: string;+ name: string;+ productType: {+ name: string;+ };+ thumbnailUrl: string;+ }>;onNextPage();onPreviousPage();}@@ -75,13 +82,13 @@ export const ProductList = decorate<ProductListProps>(</TableCell></TableRow>) : products.length > 0 ? (- products.map(edge => (- <TableRow key={edge.node.id}>+ products.map(product => (+ <TableRow key={product.id}><TableCell className={classes.avatarCell}>- <Avatar src={edge.node.thumbnailUrl} />+ <Avatar src={product.thumbnailUrl} /></TableCell>- <TableCell>{edge.node.name}</TableCell>- <TableCell>{edge.node.productType.name}</TableCell>+ <TableCell>{product.name}</TableCell>+ <TableCell>{product.productType.name}</TableCell></TableRow>))) : (diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ProductList.test.tsx.snap b/saleor/static/dashboard-next/js/components/ProductList/__snapshots__/ProductList.test.tsx.snapsimilarity index 63%rename from saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ProductList.test.tsx.snaprename to saleor/static/dashboard-next/js/components/ProductList/__snapshots__/ProductList.test.tsx.snapindex a8911a3b6d..b79e7a0e27 100644--- a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ProductList.test.tsx.snap+++ b/saleor/static/dashboard-next/js/components/ProductList/__snapshots__/ProductList.test.tsx.snap@@ -232,251 +232,6 @@ exports[`<ProductList /> renders properly 'load more' button 1`] = `T-sirts</td></tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_VX2ikxl-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Jacobson, Stewart and Rodriguez- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_wl4FUo7-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Sloan Ltd- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_c0nSiAe-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Foster-Beard- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/6_qHI83dZ-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Henson PLC- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_06TblXK-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Novak, Lopez and Cook- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/6_yMYqzTc-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Thompson-Jones- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_eWtYYcz-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Cunningham, Torres and Day- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr></tbody></table>`;@@ -710,251 +465,6 @@ exports[`<ProductList /> renders properly when data is loaded 1`] = `T-sirts</td></tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_VX2ikxl-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Jacobson, Stewart and Rodriguez- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_wl4FUo7-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Sloan Ltd- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_c0nSiAe-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Foster-Beard- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/6_qHI83dZ-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Henson PLC- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_06TblXK-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Novak, Lopez and Cook- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/6_yMYqzTc-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Thompson-Jones- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr>- <tr- className="MuiTableRow-root-4"- >- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11 Component-avatarCell-1"- scope={undefined}- >- <div- className="MuiAvatar-root-45"- >- <img- alt={undefined}- className="MuiAvatar-img-47"- sizes={undefined}- src="/media/__sized__/products/saleor/static/placeholders/t-shirts/5_eWtYYcz-crop-c0-5__0-5-255x255-70.jpg"- srcSet={undefined}- />- </div>- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- Cunningham, Torres and Day- </td>- <td- aria-sort={null}- className="MuiTableCell-root-9 MuiTableCell-body-11"- scope={undefined}- >- T-sirts- </td>- </tr></tbody></table>`;diff --git a/saleor/static/dashboard-next/js/components/ProductList/index.ts b/saleor/static/dashboard-next/js/components/ProductList/index.tsnew file mode 100644index 0000000000..17fd4319e3--- /dev/null+++ b/saleor/static/dashboard-next/js/components/ProductList/index.ts@@ -0,0 +1 @@+export { default } from "./ProductList";