@arcteryx/components-cart
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [4.1.1](http://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/components-cart@4.1.0...@arcteryx/components-cart@4.1.1) (2020-11-18) | ||
### Bug Fixes | ||
* **TAS Cart API:** TMS-519 Apply data model property naming not totalItems ([90da310](http://bitbucket.org/arcteryx/arcteryx-js-helpers/commits/90da310341c0d2506f04dc55660a66390dd85d0c)) | ||
# [4.1.0](http://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/components-cart@4.0.3...@arcteryx/components-cart@4.1.0) (2020-11-17) | ||
@@ -8,0 +19,0 @@ |
@@ -1052,3 +1052,3 @@ 'use strict'; | ||
const CartCount = ({ | ||
totalItems | ||
quantity | ||
}) => { | ||
@@ -1061,3 +1061,3 @@ const { | ||
}, "(", t("{{count}} Item", { | ||
count: totalItems | ||
count: quantity | ||
}), ")")); | ||
@@ -1078,6 +1078,6 @@ }; | ||
}, isSidebar || isFlyIn ? /*#__PURE__*/React__default.createElement(H2, null, /*#__PURE__*/React__default.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
quantity: cart.quantity | ||
})) : /*#__PURE__*/React__default.createElement(StyledCartHeaderH3, null, /*#__PURE__*/React__default.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
})), cart.totalItems > 0 && | ||
quantity: cart.quantity | ||
})), cart.quantity > 0 && | ||
/*#__PURE__*/ | ||
@@ -1084,0 +1084,0 @@ // to only show cart count when empty cart |
@@ -1044,3 +1044,3 @@ import React, { useContext, Fragment } from 'react'; | ||
const CartCount = ({ | ||
totalItems | ||
quantity | ||
}) => { | ||
@@ -1053,3 +1053,3 @@ const { | ||
}, "(", t("{{count}} Item", { | ||
count: totalItems | ||
count: quantity | ||
}), ")")); | ||
@@ -1070,6 +1070,6 @@ }; | ||
}, isSidebar || isFlyIn ? /*#__PURE__*/React.createElement(H2, null, /*#__PURE__*/React.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
quantity: cart.quantity | ||
})) : /*#__PURE__*/React.createElement(StyledCartHeaderH3, null, /*#__PURE__*/React.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
})), cart.totalItems > 0 && | ||
quantity: cart.quantity | ||
})), cart.quantity > 0 && | ||
/*#__PURE__*/ | ||
@@ -1076,0 +1076,0 @@ // to only show cart count when empty cart |
@@ -1052,3 +1052,3 @@ (function (global, factory) { | ||
const CartCount = ({ | ||
totalItems | ||
quantity | ||
}) => { | ||
@@ -1061,3 +1061,3 @@ const { | ||
}, "(", t("{{count}} Item", { | ||
count: totalItems | ||
count: quantity | ||
}), ")")); | ||
@@ -1078,6 +1078,6 @@ }; | ||
}, isSidebar || isFlyIn ? /*#__PURE__*/React__default.createElement(H2, null, /*#__PURE__*/React__default.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
quantity: cart.quantity | ||
})) : /*#__PURE__*/React__default.createElement(StyledCartHeaderH3, null, /*#__PURE__*/React__default.createElement(CartCount, { | ||
totalItems: cart.totalItems | ||
})), cart.totalItems > 0 && | ||
quantity: cart.quantity | ||
})), cart.quantity > 0 && | ||
/*#__PURE__*/ | ||
@@ -1084,0 +1084,0 @@ // to only show cart count when empty cart |
{ | ||
"name": "@arcteryx/components-cart", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Arcteryx Cart", | ||
@@ -18,3 +18,3 @@ "source": "src/index.js", | ||
"license": "ISC", | ||
"gitHead": "4aec95e404f5ac246608c2655fbd57eaeae66c39", | ||
"gitHead": "47c985af2a405f2643220bf6da3385686558ad24", | ||
"peerDependencies": { | ||
@@ -21,0 +21,0 @@ "@arcteryx/components-contexts": "^1.1.0", |
@@ -8,3 +8,3 @@ import { Button } from "@arcteryx/components-button"; | ||
import { CartProduct, CartShell } from "./index.js"; | ||
import tasCart, { manyItems as manyTasItems } from '../__tests__/tas.cart'; | ||
import tasCart, { manyItems as manyTasItems } from '../__mocks__/tas.cart'; | ||
@@ -11,0 +11,0 @@ const cart = TasCart.$create(manyTasItems); |
@@ -8,3 +8,3 @@ import { TasCart } from '@arcteryx/data-models'; | ||
import CartDetails from "./CartDetails"; | ||
import tasCart from '../../../__tests__/tas.cart'; | ||
import tasCart from '../../../__mocks__/tas.cart'; | ||
@@ -11,0 +11,0 @@ jest.mock("@arcteryx/components-price", () => jest.fn(() => <code>PRICE</code>)); |
@@ -40,7 +40,7 @@ import React, { Fragment } from "react"; | ||
const CartCount = ({ totalItems }) => { | ||
const CartCount = ({ quantity }) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<> | ||
{t("My Cart")} <span className="qa-total-items">({t("{{count}} Item", { count: totalItems })})</span> | ||
{t("My Cart")} <span className="qa-total-items">({t("{{count}} Item", { count: quantity })})</span> | ||
</> | ||
@@ -57,10 +57,10 @@ ); | ||
<H2> | ||
<CartCount totalItems={cart.totalItems} /> | ||
<CartCount quantity={cart.quantity} /> | ||
</H2> | ||
) : ( | ||
<StyledCartHeaderH3> | ||
<CartCount totalItems={cart.totalItems} /> | ||
<CartCount quantity={cart.quantity} /> | ||
</StyledCartHeaderH3> | ||
)} | ||
{cart.totalItems > 0 && ( // to only show cart count when empty cart | ||
{cart.quantity > 0 && ( // to only show cart count when empty cart | ||
<Fragment> | ||
@@ -67,0 +67,0 @@ <StyledCartHeaderH4>{t("Quantity")}</StyledCartHeaderH4> |
@@ -0,9 +1,13 @@ | ||
import { TasCart } from '@arcteryx/data-models'; | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import CartHeader from "./CartHeader"; | ||
import "jest-styled-components"; | ||
import CartHeader from "./CartHeader"; | ||
import { manyItems as manyTasItems } from '../../../__mocks__/tas.cart'; | ||
describe("Cart Header Component", () => { | ||
const cart = TasCart.$create(manyTasItems); | ||
it("Renders Cart Header", () => { | ||
const { container } = render(<CartHeader cart={{ totalItems: 42 }} />); | ||
const { container } = render(<CartHeader cart={cart} />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
@@ -13,5 +17,5 @@ }); | ||
it("Renders Cart Header for Fly In Cart", () => { | ||
const { container } = render(<CartHeader cart={{ totalItems: 42 }} isFlyIn={true} />); | ||
const { container } = render(<CartHeader cart={cart} isFlyIn />); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -9,3 +9,3 @@ import { TasCart } from '@arcteryx/data-models'; | ||
import Quantity from "./Quantity.js"; | ||
import tasCart from '../../../__tests__/tas.cart'; | ||
import tasCart from '../../../__mocks__/tas.cart'; | ||
@@ -12,0 +12,0 @@ jest.mock("@arcteryx/components-price", () => jest.fn(() => <code>PRICE</code>)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
374422
4430