@magento/venia-ui 9.4.0 → 9.5.0
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 +2 -0
- package/lib/RootComponents/CMS/__tests__/cms.spec.js +4 -0
- package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.spec.js.snap +9 -0
- package/lib/RootComponents/Category/category.js +19 -1
- package/lib/RootComponents/Category/categoryContent.js +1 -1
- package/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap +1 -0
- package/lib/components/AccountInformationPage/accountInformationPage.js +1 -0
- package/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap +3 -0
- package/lib/components/AddressBookPage/addressBookPage.js +5 -1
- package/lib/components/AddressBookPage/addressBookPage.module.css +3 -0
- package/lib/components/CartPage/__tests__/__snapshots__/cartPage.spec.js.snap +2 -0
- package/lib/components/CartPage/cartPage.js +5 -1
- package/lib/components/CheckoutPage/AddressBook/__tests__/__snapshots__/addressBook.spec.js.snap +2 -0
- package/lib/components/CheckoutPage/AddressBook/addressBook.js +1 -1
- package/lib/components/CheckoutPage/GuestSignIn/__tests__/__snapshots__/guestSignIn.spec.js.snap +3 -0
- package/lib/components/CheckoutPage/GuestSignIn/guestSignIn.js +1 -1
- package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +1 -1
- package/lib/components/CheckoutPage/OrderSummary/__tests__/__snapshots__/orderSummary.spec.js.snap +1 -0
- package/lib/components/CheckoutPage/OrderSummary/orderSummary.js +1 -1
- package/lib/components/CheckoutPage/PaymentInformation/brainTreeDropIn.js +7 -2
- package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +1 -0
- package/lib/components/CheckoutPage/checkoutPage.js +1 -0
- package/lib/components/CreateAccount/__tests__/createAccount.spec.js +4 -0
- package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +1 -0
- package/lib/components/Footer/footer.js +8 -2
- package/lib/components/Gallery/__tests__/gallery.spec.js +3 -0
- package/lib/components/Gallery/__tests__/item.spec.js +3 -0
- package/lib/components/Gallery/item.js +5 -0
- package/lib/components/Header/__tests__/__snapshots__/cartTrigger.spec.js.snap +6 -0
- package/lib/components/Header/__tests__/__snapshots__/currencySwitcher.spec.js.snap +16 -2
- package/lib/components/Header/__tests__/__snapshots__/storeSwitcher.spec.js.snap +17 -0
- package/lib/components/Header/cartTrigger.js +2 -0
- package/lib/components/Header/currencySwitcher.js +8 -2
- package/lib/components/Header/header.js +5 -0
- package/lib/components/Header/storeSwitcher.js +9 -4
- package/lib/components/Logo/logo.js +0 -1
- package/lib/components/MiniCart/miniCart.js +1 -0
- package/lib/components/MyAccount/ResetPassword/__tests__/__snapshots__/resetPassword.spec.js.snap +12 -4
- package/lib/components/MyAccount/ResetPassword/resetPassword.js +1 -1
- package/lib/components/OrderHistoryPage/__tests__/__snapshots__/orderHistoryPage.spec.js.snap +5 -0
- package/lib/components/OrderHistoryPage/orderHistoryPage.js +3 -1
- package/lib/components/PageLoadingIndicator/__tests__/__snapshots__/pageLoadingIndicator.spec.js.snap +21 -0
- package/lib/components/PageLoadingIndicator/__tests__/pageLoadingIndicator.spec.js +4 -4
- package/lib/components/PageLoadingIndicator/pageLoadingIndicator.js +6 -2
- package/lib/components/PageLoadingIndicator/pageLoadingIndicator.module.css +6 -1
- package/lib/components/ProductFullDetail/__tests__/__snapshots__/productFullDetail.spec.js.snap +13 -0
- package/lib/components/ProductFullDetail/productFullDetail.js +1 -0
- package/lib/components/SavedPaymentsPage/__tests__/__snapshots__/savedPaymentsPage.spec.js.snap +2 -0
- package/lib/components/SavedPaymentsPage/savedPaymentsPage.js +3 -1
- package/lib/components/SearchBar/__tests__/autocomplete.spec.js +25 -10
- package/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +3 -0
- package/lib/components/SearchBar/autocomplete.js +4 -0
- package/lib/components/SearchBar/suggestedProduct.js +20 -21
- package/lib/components/SearchPage/__tests__/__snapshots__/searchPage.spec.js.snap +22 -0
- package/lib/components/SearchPage/searchPage.js +11 -3
- package/lib/components/SignIn/__tests__/signIn.spec.js +4 -0
- package/lib/components/SortedByContainer/sortedByContainer.module.css +0 -2
- package/lib/components/StoreCodeRoute/__tests__/storeCodeRoute.spec.js +2 -2
- package/lib/components/StoreCodeRoute/storeCodeRoute.js +3 -3
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +5 -0
- package/lib/components/WishlistPage/wishlistPage.js +5 -1
- package/lib/index.module.css +14 -0
- package/lib/targets/__tests__/venia-ui-targets.spec.js +2 -2
- package/lib/tokens.module.css +1 -1
- package/package.json +5 -5
package/i18n/en_US.json
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"cartPage.wishlist.ce.successMessage": "An item has been successfully added to your favorites list.",
|
|
52
52
|
"cartPage.wishlist.ee.successMessage": "An item has been successfully added to the \"{wishlistName}\" list.",
|
|
53
53
|
"cartTrigger.ariaLabel": "Toggle mini cart. You have {count} items in your cart.",
|
|
54
|
+
"category.notFound": "Looks like the category you were hoping to find doesn't exist. Sorry about that.",
|
|
54
55
|
"categoryContent.filter": "Filter",
|
|
55
56
|
"categoryContent.itemsSortedBy": "Items sorted by ",
|
|
56
57
|
"categoryContent.resultCount": "{count} Results",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"checkoutPage.paymentLoadingError": "There was an error loading payments.",
|
|
86
87
|
"checkoutPage.paymentMethodStatus": "{selectedPaymentMethod} is not supported for editing.",
|
|
87
88
|
"checkoutPage.paymentSummary": "{cardType} ending in {lastFour}",
|
|
89
|
+
"checkoutPage.cardPlaceholder": "16-Digit Number",
|
|
88
90
|
"checkoutPage.placeOrder": "Place Order",
|
|
89
91
|
"checkoutPage.quantity": "Qty : {quantity}",
|
|
90
92
|
"checkoutPage.quickCheckout": "Quick Checkout When You Return",
|
|
@@ -6,6 +6,10 @@ import { StoreTitle } from '../../../components/Head';
|
|
|
6
6
|
import CMSPage from '../cms';
|
|
7
7
|
import { useAppContext } from '@magento/peregrine/lib/context/app';
|
|
8
8
|
|
|
9
|
+
jest.mock('@magento/peregrine/lib/context/eventing', () => ({
|
|
10
|
+
useEventingContext: jest.fn().mockReturnValue([{}, { dispatch: jest.fn() }])
|
|
11
|
+
}));
|
|
12
|
+
|
|
9
13
|
jest.mock('../../../classify');
|
|
10
14
|
|
|
11
15
|
jest.mock('../../../components/Head', () => ({
|
|
@@ -13,6 +13,7 @@ Array [
|
|
|
13
13
|
className="categoryHeader"
|
|
14
14
|
>
|
|
15
15
|
<h1
|
|
16
|
+
aria-live="polite"
|
|
16
17
|
className="title"
|
|
17
18
|
>
|
|
18
19
|
<div
|
|
@@ -110,6 +111,7 @@ Array [
|
|
|
110
111
|
className="categoryHeader"
|
|
111
112
|
>
|
|
112
113
|
<h1
|
|
114
|
+
aria-live="polite"
|
|
113
115
|
className="title"
|
|
114
116
|
>
|
|
115
117
|
<div
|
|
@@ -221,6 +223,7 @@ Array [
|
|
|
221
223
|
className="categoryHeader"
|
|
222
224
|
>
|
|
223
225
|
<h1
|
|
226
|
+
aria-live="polite"
|
|
224
227
|
className="title"
|
|
225
228
|
>
|
|
226
229
|
<div
|
|
@@ -332,6 +335,7 @@ Array [
|
|
|
332
335
|
className="categoryHeader"
|
|
333
336
|
>
|
|
334
337
|
<h1
|
|
338
|
+
aria-live="polite"
|
|
335
339
|
className="title"
|
|
336
340
|
>
|
|
337
341
|
<div
|
|
@@ -451,6 +455,7 @@ Array [
|
|
|
451
455
|
className="categoryHeader"
|
|
452
456
|
>
|
|
453
457
|
<h1
|
|
458
|
+
aria-live="polite"
|
|
454
459
|
className="title"
|
|
455
460
|
>
|
|
456
461
|
<div
|
|
@@ -501,6 +506,7 @@ Array [
|
|
|
501
506
|
className="categoryHeader"
|
|
502
507
|
>
|
|
503
508
|
<h1
|
|
509
|
+
aria-live="polite"
|
|
504
510
|
className="title"
|
|
505
511
|
>
|
|
506
512
|
<div
|
|
@@ -569,6 +575,7 @@ Array [
|
|
|
569
575
|
className="categoryHeader"
|
|
570
576
|
>
|
|
571
577
|
<h1
|
|
578
|
+
aria-live="polite"
|
|
572
579
|
className="title"
|
|
573
580
|
>
|
|
574
581
|
<div
|
|
@@ -666,6 +673,7 @@ Array [
|
|
|
666
673
|
className="categoryHeader"
|
|
667
674
|
>
|
|
668
675
|
<h1
|
|
676
|
+
aria-live="polite"
|
|
669
677
|
className="title"
|
|
670
678
|
>
|
|
671
679
|
<div
|
|
@@ -716,6 +724,7 @@ Array [
|
|
|
716
724
|
className="categoryHeader"
|
|
717
725
|
>
|
|
718
726
|
<h1
|
|
727
|
+
aria-live="polite"
|
|
719
728
|
className="title"
|
|
720
729
|
>
|
|
721
730
|
<div
|
|
@@ -8,9 +8,16 @@ import defaultClasses from './category.module.css';
|
|
|
8
8
|
import { Meta } from '../../components/Head';
|
|
9
9
|
import { GET_PAGE_SIZE } from './category.gql';
|
|
10
10
|
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
11
|
+
import { useIntl } from 'react-intl';
|
|
12
|
+
|
|
13
|
+
const MESSAGES = new Map().set(
|
|
14
|
+
'NOT_FOUND',
|
|
15
|
+
"Looks like the category you were hoping to find doesn't exist. Sorry about that."
|
|
16
|
+
);
|
|
11
17
|
|
|
12
18
|
const Category = props => {
|
|
13
19
|
const { uid } = props;
|
|
20
|
+
const { formatMessage } = useIntl();
|
|
14
21
|
|
|
15
22
|
const talonProps = useCategory({
|
|
16
23
|
id: uid,
|
|
@@ -26,7 +33,8 @@ const Category = props => {
|
|
|
26
33
|
categoryData,
|
|
27
34
|
pageControl,
|
|
28
35
|
sortProps,
|
|
29
|
-
pageSize
|
|
36
|
+
pageSize,
|
|
37
|
+
categoryNotFound
|
|
30
38
|
} = talonProps;
|
|
31
39
|
|
|
32
40
|
const classes = useStyle(defaultClasses, props.classes);
|
|
@@ -40,6 +48,16 @@ const Category = props => {
|
|
|
40
48
|
return <ErrorView />;
|
|
41
49
|
}
|
|
42
50
|
}
|
|
51
|
+
if (categoryNotFound) {
|
|
52
|
+
return (
|
|
53
|
+
<ErrorView
|
|
54
|
+
message={formatMessage({
|
|
55
|
+
id: 'category.notFound',
|
|
56
|
+
defaultMessage: MESSAGES.get('NOT_FOUND')
|
|
57
|
+
})}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
43
61
|
|
|
44
62
|
return (
|
|
45
63
|
<Fragment>
|
|
@@ -155,7 +155,7 @@ const CategoryContent = props => {
|
|
|
155
155
|
<StoreTitle>{categoryName}</StoreTitle>
|
|
156
156
|
<article className={classes.root} data-cy="CategoryContent-root">
|
|
157
157
|
<div className={classes.categoryHeader}>
|
|
158
|
-
<h1 className={classes.title}>
|
|
158
|
+
<h1 aria-live="polite" className={classes.title}>
|
|
159
159
|
<div
|
|
160
160
|
className={classes.categoryTitle}
|
|
161
161
|
data-cy="CategoryContent-categoryTitle"
|
|
@@ -6,6 +6,7 @@ exports[`renders correctly when there are existing addresses 1`] = `
|
|
|
6
6
|
>
|
|
7
7
|
Title
|
|
8
8
|
<h1
|
|
9
|
+
aria-live="polite"
|
|
9
10
|
className="heading"
|
|
10
11
|
>
|
|
11
12
|
Address Book
|
|
@@ -125,6 +126,7 @@ exports[`renders correctly when there are no existing addresses 1`] = `
|
|
|
125
126
|
>
|
|
126
127
|
Title
|
|
127
128
|
<h1
|
|
129
|
+
aria-live="polite"
|
|
128
130
|
className="heading"
|
|
129
131
|
>
|
|
130
132
|
Address Book
|
|
@@ -199,6 +201,7 @@ exports[`renders delete confirmation on address that is being deleted 1`] = `
|
|
|
199
201
|
>
|
|
200
202
|
Title
|
|
201
203
|
<h1
|
|
204
|
+
aria-live="polite"
|
|
202
205
|
className="heading"
|
|
203
206
|
>
|
|
204
207
|
Address Book
|
|
@@ -93,7 +93,11 @@ const AddressBookPage = props => {
|
|
|
93
93
|
return (
|
|
94
94
|
<div className={classes.root}>
|
|
95
95
|
<StoreTitle>{PAGE_TITLE}</StoreTitle>
|
|
96
|
-
<h1
|
|
96
|
+
<h1
|
|
97
|
+
aria-live="polite"
|
|
98
|
+
className={classes.heading}
|
|
99
|
+
data-cy="AddressBookPage-heading"
|
|
100
|
+
>
|
|
97
101
|
{PAGE_TITLE}
|
|
98
102
|
</h1>
|
|
99
103
|
<div className={classes.content} data-cy="AddressBookPage-content">
|
|
@@ -89,6 +89,7 @@ exports[`renders components if cart has items 1`] = `
|
|
|
89
89
|
className="heading_container"
|
|
90
90
|
>
|
|
91
91
|
<h1
|
|
92
|
+
aria-live="polite"
|
|
92
93
|
className="heading"
|
|
93
94
|
>
|
|
94
95
|
<mock-FormattedMessage
|
|
@@ -144,6 +145,7 @@ exports[`renders empty cart text (no adjustments, list or summary) if cart is em
|
|
|
144
145
|
className="heading_container"
|
|
145
146
|
>
|
|
146
147
|
<h1
|
|
148
|
+
aria-live="polite"
|
|
147
149
|
className="heading"
|
|
148
150
|
>
|
|
149
151
|
<mock-FormattedMessage
|
|
@@ -93,7 +93,11 @@ const CartPage = props => {
|
|
|
93
93
|
})}
|
|
94
94
|
</StoreTitle>
|
|
95
95
|
<div className={classes.heading_container}>
|
|
96
|
-
<h1
|
|
96
|
+
<h1
|
|
97
|
+
aria-live="polite"
|
|
98
|
+
data-cy="CartPage-heading"
|
|
99
|
+
className={classes.heading}
|
|
100
|
+
>
|
|
97
101
|
<FormattedMessage
|
|
98
102
|
id={'cartPage.heading'}
|
|
99
103
|
defaultMessage={'Cart'}
|
package/lib/components/CheckoutPage/AddressBook/__tests__/__snapshots__/addressBook.spec.js.snap
CHANGED
|
@@ -32,6 +32,7 @@ Array [
|
|
|
32
32
|
className="root_active"
|
|
33
33
|
>
|
|
34
34
|
<h1
|
|
35
|
+
aria-live="polite"
|
|
35
36
|
className="headerText"
|
|
36
37
|
>
|
|
37
38
|
<mock-FormattedMessage
|
|
@@ -215,6 +216,7 @@ Array [
|
|
|
215
216
|
className="root"
|
|
216
217
|
>
|
|
217
218
|
<h1
|
|
219
|
+
aria-live="polite"
|
|
218
220
|
className="headerText"
|
|
219
221
|
>
|
|
220
222
|
<mock-FormattedMessage
|
|
@@ -133,7 +133,7 @@ const AddressBook = props => {
|
|
|
133
133
|
return (
|
|
134
134
|
<Fragment>
|
|
135
135
|
<div className={rootClass}>
|
|
136
|
-
<h1 className={classes.headerText}>
|
|
136
|
+
<h1 aria-live="polite" className={classes.headerText}>
|
|
137
137
|
<FormattedMessage
|
|
138
138
|
id={'addressBook.headerText'}
|
|
139
139
|
defaultMessage={'Change Shipping Information'}
|
package/lib/components/CheckoutPage/GuestSignIn/__tests__/__snapshots__/guestSignIn.spec.js.snap
CHANGED
|
@@ -5,6 +5,7 @@ exports[`renders CreateAccount component 1`] = `
|
|
|
5
5
|
className="root"
|
|
6
6
|
>
|
|
7
7
|
<h1
|
|
8
|
+
aria-live="polite"
|
|
8
9
|
className="header"
|
|
9
10
|
>
|
|
10
11
|
<mock-FormattedMessage
|
|
@@ -59,6 +60,7 @@ exports[`renders ForgotPassword component 1`] = `
|
|
|
59
60
|
className="root"
|
|
60
61
|
>
|
|
61
62
|
<h1
|
|
63
|
+
aria-live="polite"
|
|
62
64
|
className="header"
|
|
63
65
|
>
|
|
64
66
|
<mock-FormattedMessage
|
|
@@ -112,6 +114,7 @@ exports[`renders SignIn component 2`] = `
|
|
|
112
114
|
className="root_hidden"
|
|
113
115
|
>
|
|
114
116
|
<h1
|
|
117
|
+
aria-live="polite"
|
|
115
118
|
className="header"
|
|
116
119
|
>
|
|
117
120
|
<mock-FormattedMessage
|
|
@@ -54,7 +54,7 @@ const GuestSignIn = props => {
|
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<div className={rootClass}>
|
|
57
|
-
<h1 className={classes.header}>
|
|
57
|
+
<h1 aria-live="polite" className={classes.header}>
|
|
58
58
|
<FormattedMessage
|
|
59
59
|
id="checkoutPage.guestSignIn.header"
|
|
60
60
|
defaultMessage="Account Sign-in"
|
|
@@ -9,7 +9,7 @@ const OrderSummary = props => {
|
|
|
9
9
|
const classes = useStyle(defaultClasses, props.classes);
|
|
10
10
|
return (
|
|
11
11
|
<div data-cy="OrderSummary-root" className={classes.root}>
|
|
12
|
-
<h1 className={classes.title}>
|
|
12
|
+
<h1 aria-live="polite" className={classes.title}>
|
|
13
13
|
<FormattedMessage
|
|
14
14
|
id={'checkoutPage.orderSummary'}
|
|
15
15
|
defaultMessage={'Order Summary'}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
14
|
-
import { FormattedMessage } from 'react-intl';
|
|
14
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
15
15
|
import { bool, func, shape, string } from 'prop-types';
|
|
16
16
|
|
|
17
17
|
import defaultClasses from './braintreeDropin.module.css';
|
|
@@ -39,6 +39,7 @@ const BraintreeDropin = props => {
|
|
|
39
39
|
const classes = useStyle(defaultClasses, props.classes);
|
|
40
40
|
const [isError, setIsError] = useState(false);
|
|
41
41
|
const [dropinInstance, setDropinInstance] = useState();
|
|
42
|
+
const { formatMessage } = useIntl();
|
|
42
43
|
|
|
43
44
|
const createDropinInstance = useCallback(async () => {
|
|
44
45
|
const { default: dropIn } = await import('braintree-web-drop-in');
|
|
@@ -52,6 +53,10 @@ const BraintreeDropin = props => {
|
|
|
52
53
|
overrides: {
|
|
53
54
|
fields: {
|
|
54
55
|
number: {
|
|
56
|
+
placeholder: formatMessage({
|
|
57
|
+
id: 'checkoutPage.cardPlaceholder',
|
|
58
|
+
defaultMessage: '16-Digit Number'
|
|
59
|
+
}),
|
|
55
60
|
maskInput: {
|
|
56
61
|
// Only show last four digits on blur.
|
|
57
62
|
showLastFour: true
|
|
@@ -63,7 +68,7 @@ const BraintreeDropin = props => {
|
|
|
63
68
|
});
|
|
64
69
|
|
|
65
70
|
return dropinInstance;
|
|
66
|
-
}, [containerId]);
|
|
71
|
+
}, [containerId, formatMessage]);
|
|
67
72
|
|
|
68
73
|
useEffect(() => {
|
|
69
74
|
let unmounted = false;
|
|
@@ -54,6 +54,10 @@ jest.mock('@magento/peregrine/lib/hooks/useAwaitQuery', () => {
|
|
|
54
54
|
return { useAwaitQuery };
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
jest.mock('@magento/peregrine/lib/context/eventing', () => ({
|
|
58
|
+
useEventingContext: jest.fn().mockReturnValue([{}, { dispatch: jest.fn() }])
|
|
59
|
+
}));
|
|
60
|
+
|
|
57
61
|
const props = {
|
|
58
62
|
onSubmit: jest.fn()
|
|
59
63
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import { Facebook, Instagram, Twitter } from 'react-feather';
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
5
5
|
import { shape, string } from 'prop-types';
|
|
6
6
|
import { useFooter } from '@magento/peregrine/lib/talons/Footer/useFooter';
|
|
@@ -18,6 +18,8 @@ const Footer = props => {
|
|
|
18
18
|
const talonProps = useFooter();
|
|
19
19
|
|
|
20
20
|
const { copyrightText } = talonProps;
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
22
|
+
const title = formatMessage({ id: 'logo.title', defaultMessage: 'Venia' });
|
|
21
23
|
|
|
22
24
|
const linkGroups = Array.from(links, ([groupKey, linkProps]) => {
|
|
23
25
|
const linkElements = Array.from(linkProps, ([text, pathInfo]) => {
|
|
@@ -106,7 +108,11 @@ const Footer = props => {
|
|
|
106
108
|
</li>
|
|
107
109
|
</ul>
|
|
108
110
|
<p className={classes.copyright}>{copyrightText || null}</p>
|
|
109
|
-
<Link
|
|
111
|
+
<Link
|
|
112
|
+
to={resourceUrl('/')}
|
|
113
|
+
aria-label={title}
|
|
114
|
+
className={classes.logoContainer}
|
|
115
|
+
>
|
|
110
116
|
<Logo classes={{ logo: classes.logo }} />
|
|
111
117
|
</Link>
|
|
112
118
|
</div>
|
|
@@ -3,6 +3,9 @@ import { createTestInstance } from '@magento/peregrine';
|
|
|
3
3
|
|
|
4
4
|
import Gallery from '../gallery';
|
|
5
5
|
|
|
6
|
+
jest.mock('@magento/peregrine/lib/context/eventing', () => ({
|
|
7
|
+
useEventingContext: jest.fn().mockReturnValue([{}, { dispatch: jest.fn() }])
|
|
8
|
+
}));
|
|
6
9
|
jest.mock('react-router-dom', () => ({
|
|
7
10
|
Link: ({ children }) => children
|
|
8
11
|
}));
|
|
@@ -4,6 +4,9 @@ import { createTestInstance } from '@magento/peregrine';
|
|
|
4
4
|
|
|
5
5
|
import Item from '../item';
|
|
6
6
|
|
|
7
|
+
jest.mock('@magento/peregrine/lib/context/eventing', () => ({
|
|
8
|
+
useEventingContext: jest.fn().mockReturnValue([{}, { dispatch: jest.fn() }])
|
|
9
|
+
}));
|
|
7
10
|
jest.mock('@magento/peregrine/lib/talons/Image/useImage', () => {
|
|
8
11
|
return {
|
|
9
12
|
useImage: () => ({
|
|
@@ -32,6 +32,7 @@ const GalleryItem = props => {
|
|
|
32
32
|
const {
|
|
33
33
|
handleLinkClick,
|
|
34
34
|
item,
|
|
35
|
+
itemRef,
|
|
35
36
|
wishlistButtonProps,
|
|
36
37
|
isSupportedProductType
|
|
37
38
|
} = useGalleryItem(props);
|
|
@@ -87,6 +88,7 @@ const GalleryItem = props => {
|
|
|
87
88
|
className={classes.root}
|
|
88
89
|
aria-live="polite"
|
|
89
90
|
aria-busy="false"
|
|
91
|
+
ref={itemRef}
|
|
90
92
|
>
|
|
91
93
|
<Link
|
|
92
94
|
onClick={handleLinkClick}
|
|
@@ -162,6 +164,9 @@ GalleryItem.propTypes = {
|
|
|
162
164
|
regular_price: shape({
|
|
163
165
|
value: number.isRequired,
|
|
164
166
|
currency: string.isRequired
|
|
167
|
+
}).isRequired,
|
|
168
|
+
discount: shape({
|
|
169
|
+
amount_off: number.isRequired
|
|
165
170
|
}).isRequired
|
|
166
171
|
}).isRequired
|
|
167
172
|
}).isRequired
|
|
@@ -4,6 +4,7 @@ exports[`Cart counter displays 99+ when items quantity is more than 99 1`] = `
|
|
|
4
4
|
Array [
|
|
5
5
|
<div>
|
|
6
6
|
<button
|
|
7
|
+
aria-expanded={false}
|
|
7
8
|
aria-label="Toggle mini cart. You have 100 items in your cart."
|
|
8
9
|
onClick={[Function]}
|
|
9
10
|
>
|
|
@@ -39,6 +40,7 @@ Array [
|
|
|
39
40
|
</button>
|
|
40
41
|
</div>,
|
|
41
42
|
<button
|
|
43
|
+
aria-expanded={false}
|
|
42
44
|
aria-label="Toggle mini cart. You have 100 items in your cart."
|
|
43
45
|
onClick={[Function]}
|
|
44
46
|
>
|
|
@@ -83,6 +85,7 @@ exports[`Cart icon svg has fill and correct value when cart contains items 1`] =
|
|
|
83
85
|
Array [
|
|
84
86
|
<div>
|
|
85
87
|
<button
|
|
88
|
+
aria-expanded={false}
|
|
86
89
|
aria-label="Toggle mini cart. You have 10 items in your cart."
|
|
87
90
|
onClick={[Function]}
|
|
88
91
|
>
|
|
@@ -118,6 +121,7 @@ Array [
|
|
|
118
121
|
</button>
|
|
119
122
|
</div>,
|
|
120
123
|
<button
|
|
124
|
+
aria-expanded={false}
|
|
121
125
|
aria-label="Toggle mini cart. You have 10 items in your cart."
|
|
122
126
|
onClick={[Function]}
|
|
123
127
|
>
|
|
@@ -164,6 +168,7 @@ exports[`No counter when cart is empty 1`] = `
|
|
|
164
168
|
Array [
|
|
165
169
|
<div>
|
|
166
170
|
<button
|
|
171
|
+
aria-expanded={false}
|
|
167
172
|
aria-label="Toggle mini cart. You have 0 items in your cart."
|
|
168
173
|
onClick={[Function]}
|
|
169
174
|
>
|
|
@@ -196,6 +201,7 @@ Array [
|
|
|
196
201
|
</button>
|
|
197
202
|
</div>,
|
|
198
203
|
<button
|
|
204
|
+
aria-expanded={false}
|
|
199
205
|
aria-label="Toggle mini cart. You have 0 items in your cart."
|
|
200
206
|
onClick={[Function]}
|
|
201
207
|
>
|
|
@@ -5,6 +5,7 @@ exports[`does not render CurrencySwitcher when there is only one available store
|
|
|
5
5
|
className="root"
|
|
6
6
|
>
|
|
7
7
|
<button
|
|
8
|
+
aria-expanded={false}
|
|
8
9
|
aria-label="EUR"
|
|
9
10
|
className="trigger"
|
|
10
11
|
onClick={[MockFunction]}
|
|
@@ -27,9 +28,13 @@ exports[`does not render CurrencySwitcher when there is only one available store
|
|
|
27
28
|
<div
|
|
28
29
|
className="menu"
|
|
29
30
|
>
|
|
30
|
-
<ul
|
|
31
|
+
<ul
|
|
32
|
+
role="listbox"
|
|
33
|
+
>
|
|
31
34
|
<li
|
|
35
|
+
aria-selected="EUR"
|
|
32
36
|
className="menuItem"
|
|
37
|
+
role="option"
|
|
33
38
|
>
|
|
34
39
|
<button
|
|
35
40
|
className="root"
|
|
@@ -57,7 +62,9 @@ exports[`does not render CurrencySwitcher when there is only one available store
|
|
|
57
62
|
</button>
|
|
58
63
|
</li>
|
|
59
64
|
<li
|
|
65
|
+
aria-selected="EUR"
|
|
60
66
|
className="menuItem"
|
|
67
|
+
role="option"
|
|
61
68
|
>
|
|
62
69
|
<button
|
|
63
70
|
className="root"
|
|
@@ -114,6 +121,7 @@ exports[`renders the correct tree 1`] = `
|
|
|
114
121
|
className="root"
|
|
115
122
|
>
|
|
116
123
|
<button
|
|
124
|
+
aria-expanded={false}
|
|
117
125
|
aria-label="EUR"
|
|
118
126
|
className="trigger"
|
|
119
127
|
onClick={[MockFunction]}
|
|
@@ -136,9 +144,13 @@ exports[`renders the correct tree 1`] = `
|
|
|
136
144
|
<div
|
|
137
145
|
className="menu"
|
|
138
146
|
>
|
|
139
|
-
<ul
|
|
147
|
+
<ul
|
|
148
|
+
role="listbox"
|
|
149
|
+
>
|
|
140
150
|
<li
|
|
151
|
+
aria-selected="EUR"
|
|
141
152
|
className="menuItem"
|
|
153
|
+
role="option"
|
|
142
154
|
>
|
|
143
155
|
<button
|
|
144
156
|
className="root"
|
|
@@ -166,7 +178,9 @@ exports[`renders the correct tree 1`] = `
|
|
|
166
178
|
</button>
|
|
167
179
|
</li>
|
|
168
180
|
<li
|
|
181
|
+
aria-selected="EUR"
|
|
169
182
|
className="menuItem"
|
|
183
|
+
role="option"
|
|
170
184
|
>
|
|
171
185
|
<button
|
|
172
186
|
className="root"
|