@magento/venia-ui 9.2.0-beta.1 → 9.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/i18n/en_US.json +17 -3
- package/lib/RootComponents/CMS/__tests__/__snapshots__/cms.spec.js.snap +19 -0
- package/lib/RootComponents/CMS/__tests__/cms.spec.js +4 -9
- package/lib/RootComponents/CMS/cms.js +5 -4
- package/lib/RootComponents/CMS/cms.shimmer.js +18 -0
- package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.shimmer.spec.js.snap +12 -0
- package/lib/RootComponents/Category/categoryContent.js +4 -1
- package/lib/components/AccountChip/accountChip.js +3 -1
- package/lib/components/AccountInformationPage/accountInformationPage.js +3 -1
- package/lib/components/AccountInformationPage/editModal.js +9 -2
- package/lib/components/AccountMenu/accountMenuItems.js +8 -3
- package/lib/components/CartPage/GiftCards/giftCards.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js +5 -1
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/__tests__/__snapshots__/giftOptions.spec.js.snap +1018 -78
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/__tests__/giftOptions.spec.js +221 -35
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.js +287 -40
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.module.css +56 -1
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftCardSection.ee.spec.js.snap +12 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftOptionsSection.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftOptionsSection.ee.spec.js.snap +16 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/priceAdjustments.spec.js.snap +1 -32
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftCardSection.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftCardSection.ee.spec.js +36 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftOptionsSection.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftOptionsSection.ee.spec.js +54 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/priceAdjustments.spec.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/{giftCardSection.js → giftCardSection.ce.js} +0 -0
- package/lib/components/CartPage/PriceAdjustments/giftOptionsSection.ce.js +7 -0
- package/lib/components/CartPage/PriceAdjustments/giftOptionsSection.ee.js +38 -0
- package/lib/components/CartPage/PriceAdjustments/priceAdjustments.js +2 -14
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/discountSummary.spec.js.snap +496 -42
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftCardSummary.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/{giftCardSummary.spec.js.snap → giftCardSummary.ee.spec.js.snap} +4 -4
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftOptionsSummary.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftOptionsSummary.ee.spec.js.snap +63 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/priceSummary.spec.js.snap +201 -141
- package/lib/components/CartPage/PriceSummary/__tests__/discountSummary.spec.js +41 -1
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.ee.spec.js +84 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftOptionsSummary.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftOptionsSummary.ee.spec.js +69 -0
- package/lib/components/CartPage/PriceSummary/__tests__/priceSummary.spec.js +2 -0
- package/lib/components/CartPage/PriceSummary/discountSummary.js +99 -49
- package/lib/components/CartPage/PriceSummary/discountSummary.module.css +40 -0
- package/lib/components/CartPage/PriceSummary/giftOptionsSummary.ce.js +5 -0
- package/lib/components/CartPage/PriceSummary/giftOptionsSummary.ee.js +40 -0
- package/lib/components/CartPage/PriceSummary/priceSummary.js +95 -53
- package/lib/components/CartPage/PriceSummary/priceSummary.module.css +2 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productDetail.spec.js.snap +57 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productForm.spec.js.snap +22 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/productDetail.spec.js +42 -3
- package/lib/components/CartPage/ProductListing/EditModal/productDetail.js +13 -10
- package/lib/components/CartPage/ProductListing/EditModal/productForm.js +7 -2
- package/lib/components/CartPage/ProductListing/product.js +1 -0
- package/lib/components/CartPage/ProductListing/productListing.js +1 -1
- package/lib/components/CartPage/cartPage.js +1 -1
- package/lib/components/Checkbox/checkbox.js +6 -1
- package/lib/components/Checkbox/checkbox.module.css +1 -0
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/item.spec.js.snap +2 -2
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/itemsReview.spec.js.snap +33 -0
- package/lib/components/CheckoutPage/ItemsReview/__tests__/item.spec.js +2 -2
- package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +4 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/__tests__/createAccount.spec.js +4 -0
- package/lib/components/CheckoutPage/OrderConfirmationPage/createAccount.js +9 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +12 -3
- package/lib/components/CheckoutPage/PaymentInformation/__tests__/__snapshots__/creditCard.spec.js.snap +1 -0
- package/lib/components/CheckoutPage/PaymentInformation/__tests__/creditCard.spec.js +2 -1
- package/lib/components/CheckoutPage/PaymentInformation/brainTreeDropIn.js +2 -18
- package/lib/components/CheckoutPage/PaymentInformation/creditCard.js +13 -3
- package/lib/components/CheckoutPage/PriceAdjustments/__tests__/__snapshots__/priceAdjustments.spec.js.snap +1 -6
- package/lib/components/CheckoutPage/PriceAdjustments/__tests__/priceAdjustments.spec.js +2 -2
- package/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.js +8 -12
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/customerForm.js +1 -1
- package/lib/components/CheckoutPage/ShippingInformation/shippingInformation.js +4 -1
- package/lib/components/CheckoutPage/ShippingMethod/shippingMethod.js +5 -2
- package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +3 -3
- package/lib/components/CheckoutPage/__tests__/checkoutPage.spec.js +5 -0
- package/lib/components/CheckoutPage/checkoutPage.js +25 -4
- package/lib/components/CheckoutPage/checkoutPage.module.css +8 -1
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/cmsDynamicBlock.ce.spec.js.snap +3 -0
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/cmsDynamicBlock.ee.spec.js.snap +61 -0
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/dynamicBlock.spec.js.snap +7 -0
- package/lib/components/CmsDynamicBlock/__tests__/cmsDynamicBlock.ce.spec.js +17 -0
- package/lib/components/CmsDynamicBlock/__tests__/cmsDynamicBlock.ee.spec.js +211 -0
- package/lib/components/CmsDynamicBlock/__tests__/constants.spec.js +37 -0
- package/lib/components/CmsDynamicBlock/__tests__/dynamicBlock.spec.js +33 -0
- package/lib/components/CmsDynamicBlock/cmsDynamicBlock.ce.js +5 -0
- package/lib/components/CmsDynamicBlock/cmsDynamicBlock.ee.js +73 -0
- package/lib/components/CmsDynamicBlock/constants.js +6 -0
- package/lib/components/CmsDynamicBlock/dynamicBlock.js +32 -0
- package/lib/components/CmsDynamicBlock/index.js +2 -0
- package/lib/components/CreateAccount/__tests__/createAccount.spec.js +6 -1
- package/lib/components/CreateAccount/createAccount.js +7 -2
- package/lib/components/Field/field.module.css +6 -0
- package/lib/components/FilterSidebar/filterSidebar.js +4 -1
- package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +8 -2
- package/lib/components/Footer/footer.js +16 -9
- package/lib/components/Footer/footer.module.css +7 -2
- package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/__snapshots__/forgotPasswordForm.spec.js.snap +109 -1
- package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/forgotPasswordForm.spec.js +22 -3
- package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.js +13 -3
- package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.module.css +1 -1
- package/lib/components/ForgotPassword/__tests__/__snapshots__/forgotPassword.spec.js.snap +5 -6
- package/lib/components/ForgotPassword/__tests__/forgotPassword.spec.js +41 -28
- package/lib/components/ForgotPassword/forgotPassword.js +10 -3
- package/lib/components/ForgotPassword/forgotPassword.module.css +2 -2
- package/lib/components/Gallery/__tests__/__snapshots__/gallery.spec.js.snap +22 -0
- package/lib/components/Gallery/__tests__/__snapshots__/item.spec.js.snap +17 -0
- package/lib/components/Gallery/addToCartButton.js +2 -0
- package/lib/components/Gallery/gallery.js +6 -1
- package/lib/components/Gallery/item.js +7 -2
- package/lib/components/GoogleReCaptcha/googleReCaptcha.js +49 -0
- package/lib/components/GoogleReCaptcha/googleReCaptcha.module.css +3 -0
- package/lib/components/GoogleReCaptcha/index.js +1 -0
- package/lib/components/Header/currencySwitcher.js +2 -1
- package/lib/components/Header/header.js +1 -1
- package/lib/components/Header/header.module.css +2 -2
- package/lib/components/Header/searchTrigger.js +3 -1
- package/lib/components/Header/storeSwitcher.js +18 -4
- package/lib/components/Header/switcherItem.js +4 -1
- package/lib/components/HomePage/homePage.module.css +12 -0
- package/lib/components/Image/resourceImage.js +8 -1
- package/lib/components/Image/simpleImage.js +8 -1
- package/lib/components/Link/link.js +15 -13
- package/lib/components/LoadingIndicator/spinner.js +5 -7
- package/lib/components/LoadingIndicator/spinner.module.css +4 -17
- package/lib/components/MiniCart/ProductList/__tests__/__snapshots__/item.spec.js.snap +44 -0
- package/lib/components/MiniCart/ProductList/__tests__/item.spec.js +2 -2
- package/lib/components/MiniCart/ProductList/item.js +3 -2
- package/lib/components/MiniCart/miniCart.js +6 -3
- package/lib/components/MyAccount/ResetPassword/__tests__/__snapshots__/resetPassword.spec.js.snap +274 -254
- package/lib/components/MyAccount/ResetPassword/__tests__/resetPassword.spec.js +10 -5
- package/lib/components/MyAccount/ResetPassword/resetPassword.js +55 -55
- package/lib/components/MyAccount/ResetPassword/resetPassword.module.css +27 -79
- package/lib/components/Newsletter/newsletter.js +6 -2
- package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/item.spec.js.snap +11 -0
- package/lib/components/ProductFullDetail/productFullDetail.js +12 -3
- package/lib/components/ProductImageCarousel/__tests__/__snapshots__/carousel.spec.js.snap +61 -0
- package/lib/components/ProductImageCarousel/__tests__/__snapshots__/thumbnail.spec.js.snap +26 -0
- package/lib/components/ProductOptions/__tests__/options.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/swatch.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/swatchList.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/tile.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/tileList.spec.js +1 -1
- package/lib/components/ProductOptions/option.js +4 -1
- package/lib/components/ProductSort/productSort.js +22 -14
- package/lib/components/Rating/rating.js +1 -1
- package/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +11 -0
- package/lib/components/SearchBar/autocomplete.js +4 -2
- package/lib/components/SearchBar/suggestedProduct.js +1 -1
- package/lib/components/SearchBar/suggestions.js +1 -1
- package/lib/components/SignIn/__tests__/signIn.spec.js +11 -20
- package/lib/components/SignIn/signIn.js +6 -16
- package/lib/components/TextInput/textInput.module.css +0 -4
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/__tests__/__snapshots__/wishlistLineItem.spec.js.snap +5 -1
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.js +7 -1
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.module.css +7 -0
- package/lib/components/Wishlist/WishlistDialog/__tests__/__snapshots__/wishlistDialog.spec.js.snap +6 -1
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlist.spec.js.snap +4 -0
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistItem.spec.js.snap +22 -0
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +9 -3
- package/lib/components/WishlistPage/createWishlist.ee.js +3 -1
- package/lib/components/WishlistPage/wishlist.js +1 -1
- package/lib/components/WishlistPage/wishlist.module.css +3 -0
- package/lib/components/WishlistPage/wishlistPage.js +1 -1
- package/package.json +5 -4
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.spec.js +0 -84
|
@@ -103,7 +103,10 @@ const FilterSidebar = props => {
|
|
|
103
103
|
>
|
|
104
104
|
<div className={classes.body}>
|
|
105
105
|
<div className={classes.header}>
|
|
106
|
-
<h2
|
|
106
|
+
<h2
|
|
107
|
+
data-cy="FilterSidebar-headerTitle"
|
|
108
|
+
className={classes.headerTitle}
|
|
109
|
+
>
|
|
107
110
|
<FormattedMessage
|
|
108
111
|
id={'filterModal.headerTitle'}
|
|
109
112
|
defaultMessage={'Filters'}
|
|
@@ -205,11 +205,17 @@ exports[`footer renders copyright 1`] = `
|
|
|
205
205
|
foo
|
|
206
206
|
</p>
|
|
207
207
|
<a
|
|
208
|
-
className="
|
|
208
|
+
className="logoContainer"
|
|
209
209
|
href="/"
|
|
210
210
|
onClick={[Function]}
|
|
211
211
|
>
|
|
212
|
-
<i
|
|
212
|
+
<i
|
|
213
|
+
classes={
|
|
214
|
+
Object {
|
|
215
|
+
"logo": "logo",
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/>
|
|
213
219
|
</a>
|
|
214
220
|
</div>
|
|
215
221
|
</footer>
|
|
@@ -10,6 +10,7 @@ import Newsletter from '../Newsletter';
|
|
|
10
10
|
import { useStyle } from '../../classify';
|
|
11
11
|
import defaultClasses from './footer.module.css';
|
|
12
12
|
import { DEFAULT_LINKS, LOREM_IPSUM } from './sampleData';
|
|
13
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
13
14
|
|
|
14
15
|
const Footer = props => {
|
|
15
16
|
const { links } = props;
|
|
@@ -29,11 +30,11 @@ const Footer = props => {
|
|
|
29
30
|
|
|
30
31
|
const itemKey = `text: ${text} path:${path}`;
|
|
31
32
|
const child = path ? (
|
|
32
|
-
<Link className={classes.link} to={path}
|
|
33
|
+
<Link data-cy="Footer-link" className={classes.link} to={path}>
|
|
33
34
|
<FormattedMessage id={text} defaultMessage={text} />
|
|
34
35
|
</Link>
|
|
35
36
|
) : (
|
|
36
|
-
<span className={classes.label}>
|
|
37
|
+
<span data-cy="Footer-label" className={classes.label}>
|
|
37
38
|
<FormattedMessage id={text} defaultMessage={text} />
|
|
38
39
|
</span>
|
|
39
40
|
);
|
|
@@ -53,17 +54,23 @@ const Footer = props => {
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
return (
|
|
56
|
-
<footer
|
|
57
|
+
<footer data-cy="Footer-root" className={classes.root}>
|
|
57
58
|
<div className={classes.links}>
|
|
58
59
|
{linkGroups}
|
|
59
60
|
<div className={classes.callout}>
|
|
60
|
-
<span
|
|
61
|
+
<span
|
|
62
|
+
data-cy="Footer-calloutHeading"
|
|
63
|
+
className={classes.calloutHeading}
|
|
64
|
+
>
|
|
61
65
|
<FormattedMessage
|
|
62
66
|
id={'footer.followText'}
|
|
63
67
|
defaultMessage={'Follow Us!'}
|
|
64
68
|
/>
|
|
65
69
|
</span>
|
|
66
|
-
<p
|
|
70
|
+
<p
|
|
71
|
+
data-cy="Footer-calloutText"
|
|
72
|
+
className={classes.calloutBody}
|
|
73
|
+
>
|
|
67
74
|
<FormattedMessage
|
|
68
75
|
id={'footer.calloutText'}
|
|
69
76
|
defaultMessage={LOREM_IPSUM}
|
|
@@ -85,13 +92,13 @@ const Footer = props => {
|
|
|
85
92
|
</div>
|
|
86
93
|
<div className={classes.branding}>
|
|
87
94
|
<ul className={classes.legal}>
|
|
88
|
-
<li className={classes.terms}>
|
|
95
|
+
<li data-cy="Footer-terms" className={classes.terms}>
|
|
89
96
|
<FormattedMessage
|
|
90
97
|
id={'footer.termsText'}
|
|
91
98
|
defaultMessage={'Terms of Use'}
|
|
92
99
|
/>
|
|
93
100
|
</li>
|
|
94
|
-
<li className={classes.privacy}>
|
|
101
|
+
<li data-cy="Footer-privacy" className={classes.privacy}>
|
|
95
102
|
<FormattedMessage
|
|
96
103
|
id={'footer.privacyText'}
|
|
97
104
|
defaultMessage={'Privacy Policy'}
|
|
@@ -99,8 +106,8 @@ const Footer = props => {
|
|
|
99
106
|
</li>
|
|
100
107
|
</ul>
|
|
101
108
|
<p className={classes.copyright}>{copyrightText || null}</p>
|
|
102
|
-
<Link className={classes.
|
|
103
|
-
<Logo />
|
|
109
|
+
<Link to={resourceUrl('/')} className={classes.logoContainer}>
|
|
110
|
+
<Logo classes={{ logo: classes.logo }} />
|
|
104
111
|
</Link>
|
|
105
112
|
</div>
|
|
106
113
|
</footer>
|
|
@@ -129,12 +129,17 @@
|
|
|
129
129
|
text-align: center;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.
|
|
132
|
+
.logoContainer {
|
|
133
133
|
grid-area: a;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
.logo {
|
|
137
|
+
height: var(--height);
|
|
138
|
+
width: var(--width);
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
@media (max-width: 960px) {
|
|
137
|
-
.
|
|
142
|
+
.logoContainer {
|
|
138
143
|
margin-top: 2.5rem;
|
|
139
144
|
}
|
|
140
145
|
}
|
|
@@ -1,6 +1,113 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`renders
|
|
3
|
+
exports[`renders when busy 1`] = `
|
|
4
|
+
<form
|
|
5
|
+
className="root"
|
|
6
|
+
onKeyDown={[Function]}
|
|
7
|
+
onReset={[Function]}
|
|
8
|
+
onSubmit={[Function]}
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="root"
|
|
12
|
+
>
|
|
13
|
+
<label
|
|
14
|
+
className="label"
|
|
15
|
+
>
|
|
16
|
+
Email address
|
|
17
|
+
</label>
|
|
18
|
+
<span
|
|
19
|
+
className="root"
|
|
20
|
+
style={
|
|
21
|
+
Object {
|
|
22
|
+
"--iconsAfter": 0,
|
|
23
|
+
"--iconsBefore": 0,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
>
|
|
27
|
+
<span
|
|
28
|
+
className="input"
|
|
29
|
+
>
|
|
30
|
+
<input
|
|
31
|
+
autoComplete="email"
|
|
32
|
+
className="input"
|
|
33
|
+
id="email"
|
|
34
|
+
name="email"
|
|
35
|
+
onBlur={[Function]}
|
|
36
|
+
onChange={[Function]}
|
|
37
|
+
value=""
|
|
38
|
+
/>
|
|
39
|
+
</span>
|
|
40
|
+
<span
|
|
41
|
+
className="before"
|
|
42
|
+
/>
|
|
43
|
+
<span
|
|
44
|
+
className="after"
|
|
45
|
+
/>
|
|
46
|
+
</span>
|
|
47
|
+
<p
|
|
48
|
+
className="root"
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
className="buttonContainer"
|
|
53
|
+
>
|
|
54
|
+
<button
|
|
55
|
+
className="cancelButton"
|
|
56
|
+
disabled={true}
|
|
57
|
+
onClick={[Function]}
|
|
58
|
+
onDragStart={[Function]}
|
|
59
|
+
onKeyDown={[Function]}
|
|
60
|
+
onKeyUp={[Function]}
|
|
61
|
+
onMouseDown={[Function]}
|
|
62
|
+
onMouseEnter={[Function]}
|
|
63
|
+
onMouseLeave={[Function]}
|
|
64
|
+
onMouseUp={[Function]}
|
|
65
|
+
onTouchCancel={[Function]}
|
|
66
|
+
onTouchEnd={[Function]}
|
|
67
|
+
onTouchMove={[Function]}
|
|
68
|
+
onTouchStart={[Function]}
|
|
69
|
+
type="button"
|
|
70
|
+
>
|
|
71
|
+
<span
|
|
72
|
+
className="content"
|
|
73
|
+
>
|
|
74
|
+
<mock-FormattedMessage
|
|
75
|
+
defaultMessage="Cancel"
|
|
76
|
+
id="forgotPasswordForm.cancelButtonText"
|
|
77
|
+
/>
|
|
78
|
+
</span>
|
|
79
|
+
</button>
|
|
80
|
+
<button
|
|
81
|
+
className="submitButton"
|
|
82
|
+
disabled={true}
|
|
83
|
+
onClick={[Function]}
|
|
84
|
+
onDragStart={[Function]}
|
|
85
|
+
onKeyDown={[Function]}
|
|
86
|
+
onKeyUp={[Function]}
|
|
87
|
+
onMouseDown={[Function]}
|
|
88
|
+
onMouseEnter={[Function]}
|
|
89
|
+
onMouseLeave={[Function]}
|
|
90
|
+
onMouseUp={[Function]}
|
|
91
|
+
onTouchCancel={[Function]}
|
|
92
|
+
onTouchEnd={[Function]}
|
|
93
|
+
onTouchMove={[Function]}
|
|
94
|
+
onTouchStart={[Function]}
|
|
95
|
+
type="submit"
|
|
96
|
+
>
|
|
97
|
+
<span
|
|
98
|
+
className="content"
|
|
99
|
+
>
|
|
100
|
+
<mock-FormattedMessage
|
|
101
|
+
defaultMessage="Submit"
|
|
102
|
+
id="forgotPasswordForm.submitButtonText"
|
|
103
|
+
/>
|
|
104
|
+
</span>
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</form>
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
exports[`renders when not busy 1`] = `
|
|
4
111
|
<form
|
|
5
112
|
className="root"
|
|
6
113
|
onKeyDown={[Function]}
|
|
@@ -54,6 +161,7 @@ exports[`renders correctly 1`] = `
|
|
|
54
161
|
<button
|
|
55
162
|
className="cancelButton"
|
|
56
163
|
disabled={false}
|
|
164
|
+
onClick={[Function]}
|
|
57
165
|
onDragStart={[Function]}
|
|
58
166
|
onKeyDown={[Function]}
|
|
59
167
|
onKeyUp={[Function]}
|
package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/forgotPasswordForm.spec.js
CHANGED
|
@@ -6,9 +6,24 @@ import ForgotPasswordForm from '../forgotPasswordForm';
|
|
|
6
6
|
|
|
7
7
|
jest.mock('../../../../classify');
|
|
8
8
|
|
|
9
|
-
test('renders
|
|
9
|
+
test('renders when not busy', () => {
|
|
10
10
|
const wrapper = createTestInstance(
|
|
11
|
-
<ForgotPasswordForm
|
|
11
|
+
<ForgotPasswordForm
|
|
12
|
+
isResettingPassword={false}
|
|
13
|
+
onCancel={() => {}}
|
|
14
|
+
onSubmit={() => {}}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('renders when busy', () => {
|
|
21
|
+
const wrapper = createTestInstance(
|
|
22
|
+
<ForgotPasswordForm
|
|
23
|
+
isResettingPassword={true}
|
|
24
|
+
onCancel={() => {}}
|
|
25
|
+
onSubmit={() => {}}
|
|
26
|
+
/>
|
|
12
27
|
);
|
|
13
28
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
14
29
|
});
|
|
@@ -16,7 +31,11 @@ test('renders correctly', () => {
|
|
|
16
31
|
test('calls onSubmit callback', () => {
|
|
17
32
|
const onSubmit = jest.fn();
|
|
18
33
|
const wrapper = createTestInstance(
|
|
19
|
-
<ForgotPasswordForm
|
|
34
|
+
<ForgotPasswordForm
|
|
35
|
+
isResettingPassword={false}
|
|
36
|
+
onCancel={() => {}}
|
|
37
|
+
onSubmit={onSubmit}
|
|
38
|
+
/>
|
|
20
39
|
);
|
|
21
40
|
wrapper.root.findByType(Form).props.onSubmit();
|
|
22
41
|
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
3
|
-
import { func, shape, string } from 'prop-types';
|
|
3
|
+
import { bool, func, shape, string } from 'prop-types';
|
|
4
4
|
import { Form } from 'informed';
|
|
5
5
|
|
|
6
6
|
import { useStyle } from '../../../classify';
|
|
7
7
|
import { isRequired } from '../../../util/formValidators';
|
|
8
8
|
import Button from '../../Button';
|
|
9
9
|
import Field from '../../Field';
|
|
10
|
+
import GoogleReCaptcha from '../../GoogleReCaptcha';
|
|
10
11
|
import TextInput from '../../TextInput';
|
|
11
12
|
import defaultClasses from './forgotPasswordForm.module.css';
|
|
12
13
|
|
|
13
14
|
const ForgotPasswordForm = props => {
|
|
14
15
|
const classes = useStyle(defaultClasses, props.classes);
|
|
15
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
initialValues,
|
|
18
|
+
isResettingPassword,
|
|
19
|
+
onSubmit,
|
|
20
|
+
onCancel,
|
|
21
|
+
recaptchaWidgetProps
|
|
22
|
+
} = props;
|
|
16
23
|
|
|
17
24
|
const { formatMessage } = useIntl();
|
|
18
25
|
|
|
@@ -36,6 +43,7 @@ const ForgotPasswordForm = props => {
|
|
|
36
43
|
data-cy="email"
|
|
37
44
|
/>
|
|
38
45
|
</Field>
|
|
46
|
+
<GoogleReCaptcha {...recaptchaWidgetProps} />
|
|
39
47
|
<div className={classes.buttonContainer}>
|
|
40
48
|
<Button
|
|
41
49
|
className={classes.cancelButton}
|
|
@@ -74,12 +82,14 @@ ForgotPasswordForm.propTypes = {
|
|
|
74
82
|
initialValues: shape({
|
|
75
83
|
email: string
|
|
76
84
|
}),
|
|
85
|
+
isResettingPassword: bool,
|
|
77
86
|
onCancel: func.isRequired,
|
|
78
87
|
onSubmit: func.isRequired
|
|
79
88
|
};
|
|
80
89
|
|
|
81
90
|
ForgotPasswordForm.defaultProps = {
|
|
82
|
-
initialValues: {}
|
|
91
|
+
initialValues: {},
|
|
92
|
+
isResettingPassword: false
|
|
83
93
|
};
|
|
84
94
|
|
|
85
95
|
export default ForgotPasswordForm;
|
|
@@ -12,14 +12,13 @@ exports[`should render properly 1`] = `
|
|
|
12
12
|
Please enter the email address associated with this account.
|
|
13
13
|
</p>
|
|
14
14
|
<mock-ForgotPasswordForm
|
|
15
|
-
initialValues={
|
|
16
|
-
Object {
|
|
17
|
-
"email": "gooseton@goosemail.com",
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
15
|
isResettingPassword={false}
|
|
21
|
-
onCancel={[
|
|
16
|
+
onCancel={[Function]}
|
|
22
17
|
onSubmit={[MockFunction]}
|
|
18
|
+
recaptchaWidgetProps={Object {}}
|
|
19
|
+
/>
|
|
20
|
+
<mock-FormError
|
|
21
|
+
errors={Array []}
|
|
23
22
|
/>
|
|
24
23
|
</div>
|
|
25
24
|
`;
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { act } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { createTestInstance } from '@magento/peregrine';
|
|
5
5
|
|
|
6
|
+
import ForgotPasswordForm from '../ForgotPasswordForm';
|
|
6
7
|
import ForgotPassword from '../forgotPassword';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
<mock-FormSubmissionSuccessful {...props} />
|
|
10
|
-
));
|
|
11
|
-
jest.mock('../ForgotPasswordForm', () => props => (
|
|
12
|
-
<mock-ForgotPasswordForm {...props} />
|
|
13
|
-
));
|
|
9
|
+
let mockHasCompleted = false;
|
|
14
10
|
|
|
15
11
|
jest.mock(
|
|
16
12
|
'@magento/peregrine/lib/talons/ForgotPassword/useForgotPassword',
|
|
17
13
|
() => ({
|
|
18
|
-
useForgotPassword: jest
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
useForgotPassword: jest
|
|
15
|
+
.fn()
|
|
16
|
+
.mockImplementation(({ onCancel = jest.fn() }) => ({
|
|
17
|
+
forgotPasswordEmail: 'gooseton@goosemail.com',
|
|
18
|
+
formErrors: [],
|
|
19
|
+
handleCancel: onCancel,
|
|
20
|
+
handleFormSubmit: jest.fn(),
|
|
21
|
+
hasCompleted: mockHasCompleted,
|
|
22
|
+
isResettingPassword: false,
|
|
23
|
+
recaptchaWidgetProps: {}
|
|
24
|
+
}))
|
|
26
25
|
})
|
|
27
26
|
);
|
|
28
27
|
|
|
28
|
+
jest.mock('../../FormError', () => props => <mock-FormError {...props} />);
|
|
29
|
+
jest.mock('../ForgotPasswordForm', () => props => (
|
|
30
|
+
<mock-ForgotPasswordForm {...props} />
|
|
31
|
+
));
|
|
32
|
+
jest.mock('../FormSubmissionSuccessful', () => props => (
|
|
33
|
+
<mock-FormSubmissionSuccessful {...props} />
|
|
34
|
+
));
|
|
35
|
+
|
|
29
36
|
test('should render properly', () => {
|
|
37
|
+
const tree = createTestInstance(<ForgotPassword />);
|
|
38
|
+
|
|
39
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('should render successful view if hasCompleted is true', () => {
|
|
43
|
+
mockHasCompleted = true;
|
|
44
|
+
|
|
30
45
|
const tree = createTestInstance(
|
|
31
46
|
<ForgotPassword
|
|
32
47
|
initialValues={{ email: 'gooseton@goosemail.com' }}
|
|
@@ -37,22 +52,20 @@ test('should render properly', () => {
|
|
|
37
52
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
38
53
|
});
|
|
39
54
|
|
|
40
|
-
test('should
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
formErrors: [],
|
|
44
|
-
handleCancel: jest.fn(),
|
|
45
|
-
handleFormSubmit: jest.fn(),
|
|
46
|
-
hasCompleted: true,
|
|
47
|
-
isResettingPassword: false
|
|
48
|
-
});
|
|
55
|
+
test('should call onCancel prop', () => {
|
|
56
|
+
mockHasCompleted = false;
|
|
57
|
+
const mockOnCancelProp = jest.fn();
|
|
49
58
|
|
|
50
|
-
const
|
|
59
|
+
const { root } = createTestInstance(
|
|
51
60
|
<ForgotPassword
|
|
52
61
|
initialValues={{ email: 'gooseton@goosemail.com' }}
|
|
53
|
-
onCancel={
|
|
62
|
+
onCancel={mockOnCancelProp}
|
|
54
63
|
/>
|
|
55
64
|
);
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
act(() => {
|
|
67
|
+
root.findByType(ForgotPasswordForm).props.onCancel();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
expect(mockOnCancelProp).toHaveBeenCalled();
|
|
58
71
|
});
|
|
@@ -28,7 +28,8 @@ const ForgotPassword = props => {
|
|
|
28
28
|
handleCancel,
|
|
29
29
|
handleFormSubmit,
|
|
30
30
|
hasCompleted,
|
|
31
|
-
isResettingPassword
|
|
31
|
+
isResettingPassword,
|
|
32
|
+
recaptchaWidgetProps
|
|
32
33
|
} = talonProps;
|
|
33
34
|
|
|
34
35
|
const classes = useStyle(defaultClasses, props.classes);
|
|
@@ -41,18 +42,24 @@ const ForgotPassword = props => {
|
|
|
41
42
|
<FormSubmissionSuccessful email={forgotPasswordEmail} />
|
|
42
43
|
) : (
|
|
43
44
|
<Fragment>
|
|
44
|
-
<h2 className={classes.title}>
|
|
45
|
+
<h2 data-cy="ForgotPassword-title" className={classes.title}>
|
|
45
46
|
<FormattedMessage
|
|
46
47
|
id={'forgotPassword.recoverPasswordText'}
|
|
47
48
|
defaultMessage={'Recover Password'}
|
|
48
49
|
/>
|
|
49
50
|
</h2>
|
|
50
|
-
<p
|
|
51
|
+
<p
|
|
52
|
+
data-cy="ForgotPassword-instructions"
|
|
53
|
+
className={classes.instructions}
|
|
54
|
+
>
|
|
55
|
+
{INSTRUCTIONS}
|
|
56
|
+
</p>
|
|
51
57
|
<ForgotPasswordForm
|
|
52
58
|
initialValues={initialValues}
|
|
53
59
|
isResettingPassword={isResettingPassword}
|
|
54
60
|
onSubmit={handleFormSubmit}
|
|
55
61
|
onCancel={handleCancel}
|
|
62
|
+
recaptchaWidgetProps={recaptchaWidgetProps}
|
|
56
63
|
/>
|
|
57
64
|
<FormErrors errors={formErrors} />
|
|
58
65
|
</Fragment>
|
|
@@ -23,6 +23,12 @@ exports[`renders if \`items\` is an array of objects 1`] = `
|
|
|
23
23
|
height={375}
|
|
24
24
|
loading="eager"
|
|
25
25
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
26
|
+
style={
|
|
27
|
+
Object {
|
|
28
|
+
"--height": "375px",
|
|
29
|
+
"--width": "100px",
|
|
30
|
+
}
|
|
31
|
+
}
|
|
26
32
|
width={100}
|
|
27
33
|
/>
|
|
28
34
|
<img
|
|
@@ -42,6 +48,11 @@ exports[`renders if \`items\` is an array of objects 1`] = `
|
|
|
42
48
|
/test/product/1.png 1280w,
|
|
43
49
|
/test/product/1.png 1600w,
|
|
44
50
|
/test/product/1.png 2560w"
|
|
51
|
+
style={
|
|
52
|
+
Object {
|
|
53
|
+
"--width": "100px",
|
|
54
|
+
}
|
|
55
|
+
}
|
|
45
56
|
width={100}
|
|
46
57
|
/>
|
|
47
58
|
</div>
|
|
@@ -108,6 +119,12 @@ exports[`renders if \`items\` is an array of objects 1`] = `
|
|
|
108
119
|
height={375}
|
|
109
120
|
loading="eager"
|
|
110
121
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
122
|
+
style={
|
|
123
|
+
Object {
|
|
124
|
+
"--height": "375px",
|
|
125
|
+
"--width": "100px",
|
|
126
|
+
}
|
|
127
|
+
}
|
|
111
128
|
width={100}
|
|
112
129
|
/>
|
|
113
130
|
<img
|
|
@@ -127,6 +144,11 @@ exports[`renders if \`items\` is an array of objects 1`] = `
|
|
|
127
144
|
/test/product/2.png 1280w,
|
|
128
145
|
/test/product/2.png 1600w,
|
|
129
146
|
/test/product/2.png 2560w"
|
|
147
|
+
style={
|
|
148
|
+
Object {
|
|
149
|
+
"--width": "100px",
|
|
150
|
+
}
|
|
151
|
+
}
|
|
130
152
|
width={100}
|
|
131
153
|
/>
|
|
132
154
|
</div>
|
|
@@ -18,6 +18,11 @@ exports[`renders a placeholder item while awaiting item 1`] = `
|
|
|
18
18
|
className="image placeholder_layoutOnly"
|
|
19
19
|
loading="eager"
|
|
20
20
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
21
|
+
style={
|
|
22
|
+
Object {
|
|
23
|
+
"--width": "100px",
|
|
24
|
+
}
|
|
25
|
+
}
|
|
21
26
|
width={100}
|
|
22
27
|
/>
|
|
23
28
|
<img
|
|
@@ -27,6 +32,7 @@ exports[`renders a placeholder item while awaiting item 1`] = `
|
|
|
27
32
|
onError={[MockFunction]}
|
|
28
33
|
onLoad={[MockFunction]}
|
|
29
34
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
35
|
+
style={Object {}}
|
|
30
36
|
/>
|
|
31
37
|
</div>
|
|
32
38
|
</div>
|
|
@@ -73,6 +79,12 @@ exports[`renders correctly with valid item data 1`] = `
|
|
|
73
79
|
height={375}
|
|
74
80
|
loading="eager"
|
|
75
81
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
82
|
+
style={
|
|
83
|
+
Object {
|
|
84
|
+
"--height": "375px",
|
|
85
|
+
"--width": "100px",
|
|
86
|
+
}
|
|
87
|
+
}
|
|
76
88
|
width={100}
|
|
77
89
|
/>
|
|
78
90
|
<img
|
|
@@ -92,6 +104,11 @@ exports[`renders correctly with valid item data 1`] = `
|
|
|
92
104
|
/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=1280&height=1600&fit=cover 1280w,
|
|
93
105
|
/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=1600&height=2000&fit=cover 1600w,
|
|
94
106
|
/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=2560&height=3200&fit=cover 2560w"
|
|
107
|
+
style={
|
|
108
|
+
Object {
|
|
109
|
+
"--width": "100px",
|
|
110
|
+
}
|
|
111
|
+
}
|
|
95
112
|
width={100}
|
|
96
113
|
/>
|
|
97
114
|
</div>
|
|
@@ -37,6 +37,7 @@ const AddToCartButton = props => {
|
|
|
37
37
|
|
|
38
38
|
const buttonInStock = (
|
|
39
39
|
<Button
|
|
40
|
+
data-cy="AddToCartButton-buttonInStock"
|
|
40
41
|
aria-label={formatMessage({
|
|
41
42
|
id: 'addToCartButton.addItemToCartAriaLabel',
|
|
42
43
|
defaultMessage: 'Add to Cart'
|
|
@@ -59,6 +60,7 @@ const AddToCartButton = props => {
|
|
|
59
60
|
|
|
60
61
|
const buttonOutOfStock = (
|
|
61
62
|
<Button
|
|
63
|
+
data-cy="AddtoCartButton-buttonOutOfStock"
|
|
62
64
|
aria-label={formatMessage({
|
|
63
65
|
id: 'addToCartButton.itemOutOfStockAriaLabel',
|
|
64
66
|
defaultMessage: 'Out of Stock'
|
|
@@ -37,7 +37,12 @@ const Gallery = props => {
|
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<div
|
|
40
|
+
<div
|
|
41
|
+
data-cy="Gallery-root"
|
|
42
|
+
className={classes.root}
|
|
43
|
+
aria-live="polite"
|
|
44
|
+
aria-busy="false"
|
|
45
|
+
>
|
|
41
46
|
<div className={classes.items}>{galleryItems}</div>
|
|
42
47
|
</div>
|
|
43
48
|
);
|
|
@@ -77,7 +77,12 @@ const GalleryItem = props => {
|
|
|
77
77
|
// ) : null;
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<div
|
|
80
|
+
<div
|
|
81
|
+
data-cy="GalleryItem-root"
|
|
82
|
+
className={classes.root}
|
|
83
|
+
aria-live="polite"
|
|
84
|
+
aria-busy="false"
|
|
85
|
+
>
|
|
81
86
|
<Link
|
|
82
87
|
onClick={handleLinkClick}
|
|
83
88
|
to={productLink}
|
|
@@ -105,7 +110,7 @@ const GalleryItem = props => {
|
|
|
105
110
|
>
|
|
106
111
|
<span>{name}</span>
|
|
107
112
|
</Link>
|
|
108
|
-
<div className={classes.price}>
|
|
113
|
+
<div data-cy="GalleryItem-price" className={classes.price}>
|
|
109
114
|
<Price
|
|
110
115
|
value={price_range.maximum_price.regular_price.value}
|
|
111
116
|
currencyCode={
|