This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #928 from mirumee/fix/crash-on-search-for-products…
…-without-category Add default value to product item category in case none is provided
- Loading branch information
Showing
6 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/components/OverlayManager/Search/__snapshots__/stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots components/OverlayManager/Search/ProductItem default 1`] = ` | ||
.c0 { | ||
position: relative; | ||
margin: 20px; | ||
} | ||
|
||
.c1 { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
border: 3px solid rgba(0,0,0,0.2); | ||
top: 0; | ||
left: 0; | ||
pointer-events: none; | ||
box-sizing: border-box; | ||
} | ||
|
||
<div | ||
className="c0" | ||
> | ||
<li | ||
className="search__products__item" | ||
> | ||
<a | ||
href="/product/product-name/72/" | ||
onClick={[Function]} | ||
> | ||
<img | ||
alt="placeholder" | ||
src={[Function]} | ||
/> | ||
<span> | ||
<h4> | ||
Product Name | ||
</h4> | ||
<p> | ||
Category Name | ||
</p> | ||
</span> | ||
</a> | ||
</li> | ||
<div | ||
className="c1" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`Storyshots components/OverlayManager/Search/ProductItem without category 1`] = ` | ||
.c0 { | ||
position: relative; | ||
margin: 20px; | ||
} | ||
|
||
.c1 { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
border: 3px solid rgba(0,0,0,0.2); | ||
top: 0; | ||
left: 0; | ||
pointer-events: none; | ||
box-sizing: border-box; | ||
} | ||
|
||
<div | ||
className="c0" | ||
> | ||
<li | ||
className="search__products__item" | ||
> | ||
<a | ||
href="/product/product-name/72/" | ||
onClick={[Function]} | ||
> | ||
<img | ||
alt="placeholder" | ||
src={[Function]} | ||
/> | ||
<span> | ||
<h4> | ||
Product Name | ||
</h4> | ||
<p> | ||
- | ||
</p> | ||
</span> | ||
</a> | ||
</li> | ||
<div | ||
className="c1" | ||
/> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { storiesOf } from "@storybook/react"; | ||
import React from "react"; | ||
import { MemoryRouter } from "react-router"; | ||
|
||
import ProductItem from "./ProductItem"; | ||
|
||
storiesOf("components/OverlayManager/Search/ProductItem", module) | ||
.addParameters({ component: ProductItem }) | ||
.add("default", () => ( | ||
<MemoryRouter> | ||
<ProductItem | ||
__typename="ProductCountableEdge" | ||
node={{ | ||
__typename: "Product", | ||
thumbnail: null, | ||
thumbnail2x: null, | ||
id: "UHJvZHVjdDo3Mg==", | ||
name: "Product Name", | ||
category: { | ||
__typename: "Category", | ||
id: "categoryId", | ||
name: "Category Name", | ||
}, | ||
}} | ||
/> | ||
</MemoryRouter> | ||
)) | ||
.add("without category", () => ( | ||
<MemoryRouter> | ||
<ProductItem | ||
__typename="ProductCountableEdge" | ||
node={{ | ||
__typename: "Product", | ||
thumbnail: null, | ||
thumbnail2x: null, | ||
id: "UHJvZHVjdDo3Mg==", | ||
name: "Product Name", | ||
category: null, | ||
}} | ||
/> | ||
</MemoryRouter> | ||
)); |