@magento/venia-ui 9.0.0 → 9.2.0-alpha.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 +21 -1
- package/lib/RootComponents/CMS/__tests__/cms.spec.js +50 -20
- package/lib/RootComponents/CMS/cms.js +39 -43
- package/lib/RootComponents/CMS/cms.module.css +17 -14
- package/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +1 -1
- package/lib/RootComponents/Category/__tests__/__snapshots__/category.spec.js.snap +2 -2
- package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.spec.js.snap +60 -0
- package/lib/RootComponents/Category/__tests__/category.spec.js +1 -1
- package/lib/RootComponents/Category/__tests__/categoryContent.spec.js +8 -0
- package/lib/RootComponents/Category/category.gql.js +2 -1
- package/lib/RootComponents/Category/category.js +6 -6
- package/lib/RootComponents/Category/categoryContent.js +11 -4
- package/lib/components/Accordion/section.js +6 -2
- package/lib/components/AccountChip/accountChip.gql.js +1 -1
- package/lib/components/AccountInformationPage/accountInformationPage.gql.js +5 -7
- package/lib/components/AccountInformationPage/accountInformationPage.js +5 -1
- package/lib/components/AccountInformationPage/editForm.js +22 -4
- package/lib/components/AccountMenu/accountMenu.js +1 -1
- package/lib/components/AccountMenu/accountMenuItems.js +2 -1
- package/lib/components/AddressBookPage/__tests__/__snapshots__/addressCard.spec.js.snap +5 -0
- package/lib/components/AddressBookPage/addEditDialog.js +36 -10
- package/lib/components/AddressBookPage/addressBookPage.js +5 -2
- package/lib/components/AddressBookPage/addressCard.js +17 -4
- package/lib/components/App/app.js +5 -1
- package/lib/components/App/localeProvider.js +2 -1
- package/lib/components/Breadcrumbs/breadcrumbs.js +3 -3
- package/lib/components/Breadcrumbs/breadcrumbs.module.css +11 -3
- package/lib/components/CartPage/GiftCards/giftCard.js +1 -0
- package/lib/components/CartPage/GiftCards/giftCards.js +2 -0
- package/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js +3 -0
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.js +3 -0
- package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingForm.js +10 -2
- package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingMethods.js +2 -1
- package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingRadio.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingRadios.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/giftCardSection.ee.js +1 -0
- package/lib/components/CartPage/PriceAdjustments/priceAdjustments.js +4 -1
- package/lib/components/CartPage/PriceSummary/discountSummary.js +8 -2
- package/lib/components/CartPage/PriceSummary/giftCardSummary.ee.js +4 -1
- package/lib/components/CartPage/PriceSummary/priceSummary.js +10 -3
- package/lib/components/CartPage/PriceSummary/shippingSummary.js +6 -1
- package/lib/components/CartPage/PriceSummary/taxSummary.js +1 -1
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productDetail.spec.js.snap +3 -3
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productForm.spec.js.snap +2 -2
- package/lib/components/CartPage/ProductListing/EditModal/productDetail.js +1 -1
- package/lib/components/CartPage/ProductListing/__tests__/__snapshots__/errorMessage.spec.js.snap +11 -0
- package/lib/components/CartPage/ProductListing/__tests__/errorMessage.spec.js +20 -0
- package/lib/components/CartPage/ProductListing/__tests__/product.spec.js +1 -0
- package/lib/components/CartPage/ProductListing/errorMessage.js +31 -0
- package/lib/components/CartPage/ProductListing/errorMessage.module.css +9 -0
- package/lib/components/CartPage/ProductListing/product.js +17 -10
- package/lib/components/CartPage/ProductListing/productListing.js +6 -1
- package/lib/components/CartPage/ProductListing/productListing.module.css +6 -0
- package/lib/components/CartPage/ProductListing/quantity.js +3 -0
- package/lib/components/CartPage/cartPage.js +1 -1
- package/lib/components/CategoryList/__tests__/categoryList.spec.js +2 -0
- package/lib/components/CategoryList/categoryList.js +4 -2
- package/lib/components/CategoryList/categoryList.module.css +2 -0
- package/lib/components/CategoryList/categoryTile.js +2 -0
- package/lib/components/CategoryList/categoryTile.module.css +2 -0
- package/lib/components/CategoryList/index.js +2 -0
- package/lib/components/CategoryTree/categoryBranch.js +2 -1
- package/lib/components/CategoryTree/categoryLeaf.js +1 -0
- package/lib/components/CategoryTree/categoryTree.js +3 -3
- package/lib/components/Checkbox/checkbox.module.css +11 -3
- package/lib/components/Checkout/addressForm.js +2 -3
- package/lib/components/CheckoutPage/GuestSignIn/guestSignIn.js +6 -2
- package/lib/components/CheckoutPage/ItemsReview/__fixtures__/cartItems.js +12 -12
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/item.spec.js.snap +2 -2
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/itemsReview.spec.js.snap +3 -3
- package/lib/components/CheckoutPage/ItemsReview/item.js +1 -1
- package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +4 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/__tests__/__snapshots__/orderConfirmationPage.spec.js.snap +1 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/createAccount.js +6 -0
- package/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +10 -4
- package/lib/components/CheckoutPage/OrderSummary/orderSummary.js +1 -1
- package/lib/components/CheckoutPage/PaymentInformation/braintreeSummary.js +2 -1
- package/lib/components/CheckoutPage/PaymentInformation/creditCard.js +11 -1
- package/lib/components/CheckoutPage/PaymentInformation/editCard.js +1 -1
- package/lib/components/CheckoutPage/PaymentInformation/editModal.js +1 -1
- package/lib/components/CheckoutPage/PaymentInformation/paymentInformation.js +1 -1
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/guestForm.spec.js.snap +8 -0
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/guestForm.spec.js +56 -1
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/customerForm.js +27 -4
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/guestForm.js +96 -9
- package/lib/components/CheckoutPage/ShippingInformation/card.js +1 -1
- package/lib/components/CheckoutPage/ShippingInformation/shippingInformation.js +14 -3
- package/lib/components/CheckoutPage/ShippingMethod/completedView.js +1 -0
- package/lib/components/CheckoutPage/ShippingMethod/shippingMethod.js +2 -1
- package/lib/components/CheckoutPage/ShippingMethod/updateModal.js +1 -0
- package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +32 -0
- package/lib/components/CheckoutPage/__tests__/checkoutPage.spec.js +2 -0
- package/lib/components/CheckoutPage/checkoutPage.js +26 -4
- package/lib/components/ContactPage/__tests__/__snapshots__/contactLink.spec.js.snap +11 -0
- package/lib/components/ContactPage/__tests__/__snapshots__/contactPage.shimmer.spec.js.snap +113 -0
- package/lib/components/ContactPage/__tests__/__snapshots__/contactPage.spec.js.snap +312 -0
- package/lib/components/ContactPage/__tests__/contactLink.spec.js +58 -0
- package/lib/components/ContactPage/__tests__/contactPage.shimmer.spec.js +20 -0
- package/lib/components/ContactPage/__tests__/contactPage.spec.js +159 -0
- package/lib/components/ContactPage/contactLink.js +21 -0
- package/lib/components/ContactPage/contactPage.js +270 -0
- package/lib/components/ContactPage/contactPage.module.css +81 -0
- package/lib/components/ContactPage/contactPage.shimmer.js +104 -0
- package/lib/components/ContactPage/contactPage.shimmer.module.css +27 -0
- package/lib/components/ContactPage/index.js +2 -0
- package/lib/components/CreateAccount/createAccount.js +5 -0
- package/lib/components/Dialog/dialog.js +18 -4
- package/lib/components/ErrorMessage/errorMessage.js +7 -2
- package/lib/components/ErrorView/errorView.js +4 -2
- package/lib/components/Field/field.module.css +10 -6
- package/lib/components/FilterModal/CurrentFilters/currentFilter.js +7 -3
- package/lib/components/FilterModal/FilterList/__tests__/filterItem.spec.js +34 -5
- package/lib/components/FilterModal/FilterList/filterDefault.js +3 -2
- package/lib/components/FilterModal/FilterList/filterItem.js +27 -7
- package/lib/components/FilterModal/FilterList/filterList.js +6 -1
- package/lib/components/FilterModal/filterBlock.js +9 -4
- package/lib/components/FilterModal/filterFooter.js +1 -0
- package/lib/components/FilterModal/filterModal.js +6 -1
- package/lib/components/FilterModalOpenButton/filterModalOpenButton.js +1 -0
- package/lib/components/FilterSidebar/filterSidebar.js +6 -1
- package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +15 -0
- package/lib/components/Footer/__tests__/footer.spec.js +13 -1
- package/lib/components/Footer/footer.js +17 -8
- package/lib/components/Footer/footer.module.css +18 -3
- package/lib/components/Footer/sampleData.js +8 -3
- package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.js +3 -0
- package/lib/components/ForgotPassword/FormSubmissionSuccessful/formSubmissionSuccessful.js +4 -2
- package/lib/components/ForgotPassword/forgotPassword.gql.js +0 -1
- package/lib/components/FormError/formError.js +10 -4
- package/lib/components/Gallery/__tests__/__snapshots__/addToCartButton.spec.js.snap +0 -3
- package/lib/components/Gallery/__tests__/__snapshots__/item.spec.js.snap +1 -0
- package/lib/components/Gallery/addToCartButton.js +27 -22
- package/lib/components/Gallery/item.js +16 -4
- package/lib/components/Gallery/item.module.css +3 -1
- package/lib/components/Head/index.js +2 -1
- package/lib/components/Header/__tests__/header.spec.js +1 -1
- package/lib/components/Header/accountTrigger.js +1 -0
- package/lib/components/Header/cartTrigger.js +4 -1
- package/lib/components/Header/currencySwitcher.module.css +1 -1
- package/lib/components/Header/header.js +1 -1
- package/lib/components/Header/header.module.css +100 -96
- package/lib/components/Header/navTrigger.js +1 -0
- package/lib/components/Header/searchTrigger.js +1 -0
- package/lib/components/LegacyMiniCart/cartOptions.gql.js +7 -6
- package/lib/components/LegacyMiniCart/cartOptions.js +1 -1
- package/lib/components/LegacyMiniCart/editFormFragment.gql.js +7 -3
- package/lib/components/LegacyMiniCart/kebab.js +1 -0
- package/lib/components/LegacyMiniCart/product.js +1 -1
- package/lib/components/LegacyMiniCart/productOptions.js +6 -1
- package/lib/components/LegacyMiniCart/section.js +15 -5
- package/lib/components/Link/link.js +6 -4
- package/lib/components/Mask/mask.js +3 -3
- package/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +1 -0
- package/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +9 -0
- package/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +6 -0
- package/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +2 -0
- package/lib/components/MegaMenu/megaMenu.js +6 -2
- package/lib/components/MegaMenu/megaMenu.module.css +8 -11
- package/lib/components/MegaMenu/megaMenuItem.js +27 -6
- package/lib/components/MegaMenu/megaMenuItem.module.css +0 -5
- package/lib/components/MegaMenu/submenu.js +5 -3
- package/lib/components/MegaMenu/submenuColumn.js +15 -4
- package/lib/components/MiniCart/ProductList/__tests__/__snapshots__/item.spec.js.snap +4 -4
- package/lib/components/MiniCart/ProductList/item.js +7 -4
- package/lib/components/MiniCart/ProductList/productList.js +5 -1
- package/lib/components/MiniCart/__tests__/__snapshots__/miniCart.spec.js.snap +1 -1
- package/lib/components/MiniCart/miniCart.gql.js +4 -3
- package/lib/components/MiniCart/miniCart.js +9 -4
- package/lib/components/MyAccount/ResetPassword/resetPassword.gql.js +1 -1
- package/lib/components/Newsletter/__tests__/__snapshots__/newsletter.shimmer.spec.js.snap +40 -0
- package/lib/components/Newsletter/__tests__/__snapshots__/newsletter.spec.js.snap +173 -0
- package/lib/components/Newsletter/__tests__/newsletter.shimmer.spec.js +10 -0
- package/lib/components/Newsletter/__tests__/newsletter.spec.js +143 -0
- package/lib/components/Newsletter/index.js +1 -0
- package/lib/components/Newsletter/newsletter.js +148 -0
- package/lib/components/Newsletter/newsletter.module.css +94 -0
- package/lib/components/Newsletter/newsletter.shimmer.js +46 -0
- package/lib/components/Newsletter/newsletter.shimmer.module.css +11 -0
- package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/item.spec.js.snap +1 -1
- package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/shippingMethod.spec.js.snap +3 -0
- package/lib/components/OrderHistoryPage/OrderDetails/billingInformation.js +4 -1
- package/lib/components/OrderHistoryPage/OrderDetails/item.js +1 -1
- package/lib/components/OrderHistoryPage/OrderDetails/items.js +1 -1
- package/lib/components/OrderHistoryPage/OrderDetails/paymentMethod.js +1 -1
- package/lib/components/OrderHistoryPage/OrderDetails/shippingInformation.js +4 -1
- package/lib/components/OrderHistoryPage/OrderDetails/shippingMethod.js +5 -1
- package/lib/components/OrderHistoryPage/orderHistoryPage.js +8 -1
- package/lib/components/Pagination/pagination.js +1 -1
- package/lib/components/Pagination/tile.js +5 -1
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/__tests__/__snapshots__/boolean.spec.js.snap +20 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/__tests__/boolean.spec.js +52 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.js +74 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.module.css +9 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/__tests__/__snapshots__/date.spec.js.snap +25 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/__tests__/date.spec.js +52 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.js +82 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.module.css +9 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/__tests__/__snapshots__/dateTime.spec.js.snap +29 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/__tests__/dateTime.spec.js +53 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.js +85 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.module.css +9 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/__tests__/__snapshots__/multiSelect.spec.js.snap +36 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/__tests__/multiSelect.spec.js +88 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.js +99 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.module.css +13 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/__tests__/__snapshots__/price.spec.js.snap +23 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/__tests__/price.spec.js +52 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.js +74 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.module.css +9 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/__tests__/__snapshots__/select.spec.js.snap +36 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/__tests__/select.spec.js +88 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.js +99 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.module.css +13 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/__tests__/__snapshots__/text.spec.js.snap +33 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/__tests__/text.spec.js +74 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.js +88 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.module.css +13 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/__tests__/__snapshots__/textarea.spec.js.snap +33 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/__tests__/textarea.spec.js +74 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.js +88 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.module.css +13 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/__tests__/__snapshots__/attributeType.spec.js.snap +101 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/__tests__/attributeType.spec.js +173 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/attributeType.js +61 -0
- package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/index.js +1 -0
- package/lib/components/ProductFullDetail/CustomAttributes/__tests__/__snapshots__/customAttributes.spec.js.snap +49 -0
- package/lib/components/ProductFullDetail/CustomAttributes/__tests__/customAttributes.spec.js +78 -0
- package/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +66 -0
- package/lib/components/ProductFullDetail/CustomAttributes/customAttributes.module.css +14 -0
- package/lib/components/ProductFullDetail/CustomAttributes/index.js +1 -0
- package/lib/components/ProductFullDetail/__tests__/__snapshots__/productFullDetail.spec.js.snap +39 -0
- package/lib/components/ProductFullDetail/__tests__/productFullDetail.spec.js +3 -1
- package/lib/components/ProductFullDetail/productFullDetail.js +18 -3
- package/lib/components/ProductOptions/__tests__/__snapshots__/option.spec.js.snap +1 -1
- package/lib/components/ProductOptions/__tests__/__snapshots__/options.spec.js.snap +2 -2
- package/lib/components/ProductOptions/__tests__/__snapshots__/swatch.spec.js.snap +44 -2
- package/lib/components/ProductOptions/__tests__/__snapshots__/swatchList.spec.js.snap +22 -1
- package/lib/components/ProductOptions/__tests__/swatch.spec.js +0 -2
- package/lib/components/ProductOptions/option.js +2 -2
- package/lib/components/ProductOptions/swatch.js +7 -5
- package/lib/components/ProductOptions/swatch.module.css +11 -0
- package/lib/components/ProductOptions/tile.js +1 -0
- package/lib/components/ProductSort/__tests__/__snapshots__/sortItem.spec.js.snap +14 -0
- package/lib/components/ProductSort/__tests__/sortItem.spec.js +61 -0
- package/lib/components/ProductSort/productSort.js +84 -40
- package/lib/components/ProductSort/sortItem.js +26 -11
- package/lib/components/RadioGroup/radio.module.css +13 -5
- package/lib/components/RadioGroup/radioGroup.js +2 -1
- package/lib/components/Rating/__tests__/__snapshots__/rating.spec.js.snap +27 -0
- package/lib/components/Rating/__tests__/rating.spec.js +13 -0
- package/lib/components/Rating/index.js +1 -0
- package/lib/components/Rating/rating.js +30 -0
- package/lib/components/Rating/rating.module.css +21 -0
- package/lib/components/RichContent/richContent.module.css +52 -59
- package/lib/components/SearchBar/autocomplete.js +2 -0
- package/lib/components/SearchBar/searchBar.js +1 -1
- package/lib/components/SearchBar/searchBar.module.css +1 -0
- package/lib/components/SearchBar/searchField.js +1 -0
- package/lib/components/SearchBar/suggestedCategory.js +1 -1
- package/lib/components/SearchBar/suggestedProduct.js +6 -1
- package/lib/components/SearchPage/__tests__/__snapshots__/searchPage.spec.js.snap +195 -1
- package/lib/components/SearchPage/__tests__/searchPage.spec.js +13 -0
- package/lib/components/SearchPage/searchPage.js +20 -6
- package/lib/components/Shimmer/shimmer.js +11 -2
- package/lib/components/Shimmer/shimmer.module.css +4 -8
- package/lib/components/SignIn/__tests__/__snapshots__/signIn.spec.js.snap +126 -0
- package/lib/components/SignIn/__tests__/signIn.spec.js +11 -0
- package/lib/components/SignIn/signIn.gql.js +8 -4
- package/lib/components/SignIn/signIn.js +24 -4
- package/lib/components/TextArea/textArea.module.css +9 -0
- package/lib/components/TextInput/textInput.module.css +4 -0
- package/lib/components/ToastContainer/toast.js +23 -3
- package/lib/components/ToastContainer/toast.module.css +3 -0
- package/lib/components/Trigger/trigger.js +9 -2
- package/lib/components/Wishlist/AddToListButton/addToListButton.ee.js +1 -0
- package/lib/components/Wishlist/WishlistDialog/CreateWishlistForm/createWishlistForm.js +2 -0
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.js +1 -0
- package/lib/components/Wishlist/WishlistDialog/wishlistDialog.js +1 -0
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +5 -5
- package/lib/components/WishlistPage/createWishlist.ee.js +2 -0
- package/lib/components/WishlistPage/wishlist.js +8 -3
- package/lib/components/WishlistPage/wishlistItem.js +17 -4
- package/lib/components/WishlistPage/wishlistPage.js +5 -3
- package/lib/defaultRoutes.json +6 -0
- package/lib/targets/__tests__/venia-ui-targets.spec.js +2 -0
- package/lib/util/__tests__/shrinkGETQuery.spec.js +1 -1
- package/lib/util/apolloCache.js +2 -2
- package/lib/util/formValidators.js +10 -8
- package/lib/util/toCamelCase.js +3 -0
- package/package.json +17 -14
- package/upward.yml +19 -40
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act } from 'react-test-renderer';
|
|
3
|
+
import { Form } from 'informed';
|
|
4
|
+
import { createTestInstance, useToasts } from '@magento/peregrine';
|
|
5
|
+
import LoadingIndicator from '../../LoadingIndicator';
|
|
6
|
+
import Newsletter from '../newsletter';
|
|
7
|
+
import { useMutation } from '@apollo/client';
|
|
8
|
+
import { useNewsletter } from '@magento/peregrine/lib/talons/Newsletter/useNewsletter';
|
|
9
|
+
|
|
10
|
+
jest.mock('@apollo/client', () => ({
|
|
11
|
+
gql: jest.fn(),
|
|
12
|
+
useApolloClient: jest.fn().mockImplementation(() => {}),
|
|
13
|
+
useMutation: jest.fn().mockImplementation(() => [
|
|
14
|
+
jest.fn(),
|
|
15
|
+
{
|
|
16
|
+
error: null
|
|
17
|
+
}
|
|
18
|
+
])
|
|
19
|
+
}));
|
|
20
|
+
jest.mock('../../../classify');
|
|
21
|
+
jest.mock('../../Button', () => () => <i />);
|
|
22
|
+
jest.mock('../../LinkButton', () => () => <i />);
|
|
23
|
+
jest.mock('../../FormError/formError', () => 'FormError');
|
|
24
|
+
jest.mock('../../LoadingIndicator', () => () => <i />);
|
|
25
|
+
jest.mock('../newsletter.shimmer', () => 'NewsletterShimmer');
|
|
26
|
+
|
|
27
|
+
jest.mock('@magento/peregrine', () => {
|
|
28
|
+
const actual = jest.requireActual('@magento/peregrine');
|
|
29
|
+
const useToasts = jest.fn().mockReturnValue([{}, { addToast: jest.fn() }]);
|
|
30
|
+
return {
|
|
31
|
+
createTestInstance: actual.createTestInstance,
|
|
32
|
+
useToasts
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
jest.mock('@magento/peregrine/lib/talons/Newsletter/useNewsletter', () => {
|
|
36
|
+
return {
|
|
37
|
+
useNewsletter: jest.fn()
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
jest.mock('@magento/peregrine/lib/hooks/useAwaitQuery', () => {
|
|
41
|
+
const useAwaitQuery = jest
|
|
42
|
+
.fn()
|
|
43
|
+
.mockResolvedValue({ data: { subscribeEmailToNewsletter: {} } });
|
|
44
|
+
|
|
45
|
+
return { useAwaitQuery };
|
|
46
|
+
});
|
|
47
|
+
const mockHandleSubmit = jest.fn();
|
|
48
|
+
const talonProps = {
|
|
49
|
+
isEnabled: true,
|
|
50
|
+
errors: [],
|
|
51
|
+
handleSubmit: mockHandleSubmit,
|
|
52
|
+
isBusy: false,
|
|
53
|
+
isLoading: false,
|
|
54
|
+
setFormApi: jest.fn()
|
|
55
|
+
};
|
|
56
|
+
const props = {};
|
|
57
|
+
|
|
58
|
+
describe('#Newsletter display', () => {
|
|
59
|
+
test('renders correctly', () => {
|
|
60
|
+
useNewsletter.mockReturnValueOnce(talonProps);
|
|
61
|
+
const component = createTestInstance(<Newsletter {...props} />);
|
|
62
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('it renders shimmer while loading config', () => {
|
|
66
|
+
useNewsletter.mockReturnValueOnce({
|
|
67
|
+
...talonProps,
|
|
68
|
+
isLoading: true
|
|
69
|
+
});
|
|
70
|
+
const component = createTestInstance(<Newsletter {...props} />);
|
|
71
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('it does not display when disabled', () => {
|
|
75
|
+
useNewsletter.mockReturnValueOnce({
|
|
76
|
+
...talonProps,
|
|
77
|
+
isEnabled: false
|
|
78
|
+
});
|
|
79
|
+
const component = createTestInstance(<Newsletter {...props} />);
|
|
80
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('#Newsletter submit', () => {
|
|
85
|
+
test('calls `handleSubmit` on submit', () => {
|
|
86
|
+
useNewsletter.mockReturnValueOnce(talonProps);
|
|
87
|
+
useMutation.mockReturnValueOnce([mockHandleSubmit, {}]);
|
|
88
|
+
const values = { email: 'a' };
|
|
89
|
+
const { root } = createTestInstance(<Newsletter {...props} />);
|
|
90
|
+
|
|
91
|
+
act(() => {
|
|
92
|
+
root.findByType(Form).props.onSubmit(values);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
expect(mockHandleSubmit).toHaveBeenCalledTimes(1);
|
|
96
|
+
expect(mockHandleSubmit).toHaveBeenNthCalledWith(1, {
|
|
97
|
+
email: values.email
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('renders the loading indicator when form is submitting', () => {
|
|
102
|
+
useNewsletter.mockReturnValueOnce({
|
|
103
|
+
...talonProps,
|
|
104
|
+
isBusy: true
|
|
105
|
+
});
|
|
106
|
+
const { root } = createTestInstance(<Newsletter {...props} />);
|
|
107
|
+
act(() => {
|
|
108
|
+
expect(root.findByType(LoadingIndicator)).toBeTruthy();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('displays an error message if the email already subscribed', () => {
|
|
113
|
+
useMutation.mockReturnValueOnce([
|
|
114
|
+
jest.fn(),
|
|
115
|
+
{
|
|
116
|
+
error: {
|
|
117
|
+
graphQLErrors: [
|
|
118
|
+
{
|
|
119
|
+
message: 'This email address is already subscribed.'
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
useNewsletter.mockReturnValueOnce({
|
|
127
|
+
...talonProps,
|
|
128
|
+
errors: ['This email address is already subscribed.']
|
|
129
|
+
});
|
|
130
|
+
const component = createTestInstance(<Newsletter {...props} />);
|
|
131
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('shows a toast if there is response', () => {
|
|
135
|
+
useNewsletter.mockReturnValueOnce({
|
|
136
|
+
...talonProps,
|
|
137
|
+
newsLetterResponse: { status: 'SUBSCRIBED' }
|
|
138
|
+
});
|
|
139
|
+
const [, { addToast }] = useToasts();
|
|
140
|
+
createTestInstance(<Newsletter {...props} />);
|
|
141
|
+
expect(addToast).toHaveBeenCalled();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './newsletter';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
3
|
+
import { Form } from 'informed';
|
|
4
|
+
import { shape, string } from 'prop-types';
|
|
5
|
+
|
|
6
|
+
import { useNewsletter } from '@magento/peregrine/lib/talons/Newsletter/useNewsletter';
|
|
7
|
+
import { useToasts } from '@magento/peregrine';
|
|
8
|
+
|
|
9
|
+
import { isRequired } from '../../util/formValidators';
|
|
10
|
+
import { useStyle } from '../../classify';
|
|
11
|
+
import FormError from '../FormError';
|
|
12
|
+
import Button from '../Button';
|
|
13
|
+
import Field from '../Field';
|
|
14
|
+
import LoadingIndicator from '../LoadingIndicator';
|
|
15
|
+
import TextInput from '../TextInput';
|
|
16
|
+
import LinkButton from '../LinkButton';
|
|
17
|
+
import Shimmer from './newsletter.shimmer';
|
|
18
|
+
import defaultClasses from './newsletter.module.css';
|
|
19
|
+
|
|
20
|
+
const Newsletter = props => {
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
22
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
23
|
+
const talonProps = useNewsletter();
|
|
24
|
+
const [, { addToast }] = useToasts();
|
|
25
|
+
const {
|
|
26
|
+
isEnabled,
|
|
27
|
+
errors,
|
|
28
|
+
handleSubmit,
|
|
29
|
+
isBusy,
|
|
30
|
+
isLoading,
|
|
31
|
+
setFormApi,
|
|
32
|
+
newsLetterResponse,
|
|
33
|
+
clearErrors
|
|
34
|
+
} = talonProps;
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (newsLetterResponse && newsLetterResponse.status) {
|
|
38
|
+
addToast({
|
|
39
|
+
type: 'success',
|
|
40
|
+
message: formatMessage({
|
|
41
|
+
id: 'newsletter.subscribeMessage',
|
|
42
|
+
defaultMessage: 'The email address is subscribed.'
|
|
43
|
+
}),
|
|
44
|
+
timeout: 5000
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [addToast, formatMessage, newsLetterResponse]);
|
|
48
|
+
|
|
49
|
+
if (isLoading) {
|
|
50
|
+
return <Shimmer />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!isEnabled) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const maybeLoadingIndicator = isBusy ? (
|
|
58
|
+
<div className={classes.loadingContainer}>
|
|
59
|
+
<LoadingIndicator>
|
|
60
|
+
<FormattedMessage
|
|
61
|
+
id={'newsletter.loadingText'}
|
|
62
|
+
defaultMessage={'Subscribing'}
|
|
63
|
+
/>
|
|
64
|
+
</LoadingIndicator>
|
|
65
|
+
</div>
|
|
66
|
+
) : null;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className={classes.root} data-cy={'Newsletter-root'}>
|
|
70
|
+
{maybeLoadingIndicator}
|
|
71
|
+
<span className={classes.title}>
|
|
72
|
+
<FormattedMessage
|
|
73
|
+
id={'newsletter.titleText'}
|
|
74
|
+
defaultMessage={'Subscribe to Venia'}
|
|
75
|
+
/>
|
|
76
|
+
</span>
|
|
77
|
+
|
|
78
|
+
<p className={classes.newsletter_text}>
|
|
79
|
+
<FormattedMessage
|
|
80
|
+
id={'newsletter.infoText'}
|
|
81
|
+
defaultMessage={
|
|
82
|
+
'Recieve the latest news, update and special offers right to your inbox.'
|
|
83
|
+
}
|
|
84
|
+
/>
|
|
85
|
+
</p>
|
|
86
|
+
<FormError
|
|
87
|
+
allowErrorMessages
|
|
88
|
+
errors={Array.from(errors.values())}
|
|
89
|
+
/>
|
|
90
|
+
<Form
|
|
91
|
+
getApi={setFormApi}
|
|
92
|
+
className={classes.form}
|
|
93
|
+
onSubmit={handleSubmit}
|
|
94
|
+
>
|
|
95
|
+
<Field
|
|
96
|
+
id="email"
|
|
97
|
+
label={formatMessage({
|
|
98
|
+
id: 'global.email',
|
|
99
|
+
defaultMessage: 'Email'
|
|
100
|
+
})}
|
|
101
|
+
>
|
|
102
|
+
<TextInput
|
|
103
|
+
autoComplete="email"
|
|
104
|
+
field="email"
|
|
105
|
+
id="email"
|
|
106
|
+
validate={isRequired}
|
|
107
|
+
/>
|
|
108
|
+
</Field>
|
|
109
|
+
<LinkButton
|
|
110
|
+
className={classes.subscribe_link}
|
|
111
|
+
type="submit"
|
|
112
|
+
disabled={isBusy}
|
|
113
|
+
onClick={clearErrors}
|
|
114
|
+
>
|
|
115
|
+
<FormattedMessage
|
|
116
|
+
id={'newsletter.subscribeText'}
|
|
117
|
+
defaultMessage={'Subscribe'}
|
|
118
|
+
/>
|
|
119
|
+
</LinkButton>
|
|
120
|
+
<div className={classes.buttonsContainer}>
|
|
121
|
+
<Button
|
|
122
|
+
priority="normal"
|
|
123
|
+
type="submit"
|
|
124
|
+
disabled={isBusy}
|
|
125
|
+
onClick={clearErrors}
|
|
126
|
+
>
|
|
127
|
+
<FormattedMessage
|
|
128
|
+
id={'newsletter.subscribeText'}
|
|
129
|
+
defaultMessage={'Subscribe'}
|
|
130
|
+
/>
|
|
131
|
+
</Button>
|
|
132
|
+
</div>
|
|
133
|
+
</Form>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
Newsletter.propTypes = {
|
|
139
|
+
classes: shape({
|
|
140
|
+
modal_active: string,
|
|
141
|
+
root: string,
|
|
142
|
+
title: string,
|
|
143
|
+
form: string,
|
|
144
|
+
buttonsContainer: string
|
|
145
|
+
})
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default Newsletter;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
gap: 1.5rem;
|
|
5
|
+
justify-items: stretch;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.form {
|
|
9
|
+
display: grid;
|
|
10
|
+
row-gap: 0.9375rem;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.form input {
|
|
15
|
+
padding-right: calc(1.875rem * var(--iconsAfter) + 5.625rem);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.form label {
|
|
19
|
+
position: absolute;
|
|
20
|
+
z-index: -11111;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.buttonsContainer {
|
|
24
|
+
gap: 1.5rem;
|
|
25
|
+
grid-auto-flow: row;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
margin-top: 1rem;
|
|
28
|
+
width: 100%;
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.title {
|
|
33
|
+
color: rgb(var(--venia-global-color-gray-900));
|
|
34
|
+
font-size: var(--venia-typography-body-S-fontSize);
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
margin-bottom: 15px;
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.subscribe_link {
|
|
41
|
+
display: inline-block;
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: 4px;
|
|
44
|
+
top: 0;
|
|
45
|
+
transform: translateY(7%);
|
|
46
|
+
max-height: 35px;
|
|
47
|
+
padding: 0 10px;
|
|
48
|
+
background: rgb(var(--venia-global-color-gray-50));
|
|
49
|
+
min-height: 35px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.subscribe_link span {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
color: rgb(var(--venia-global-color-text));
|
|
55
|
+
text-decoration: underline;
|
|
56
|
+
text-shadow: 0px 0px 0px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.subscribe_link:hover span {
|
|
60
|
+
color: rgb(var(--stroke));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.newsletter_text {
|
|
64
|
+
margin-bottom: 20px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.loadingContainer {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
z-index: 1;
|
|
74
|
+
background: rgba(252, 252, 252, 0.75);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media screen and (max-width: 767px) {
|
|
78
|
+
.buttonsContainer {
|
|
79
|
+
display: grid;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.subscribe_link {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.root {
|
|
87
|
+
text-align: center;
|
|
88
|
+
grid-column: span 2;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.form input {
|
|
92
|
+
padding-right: calc(1.875rem * var(--iconsAfter) + 0.625rem);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyle } from '../../classify';
|
|
4
|
+
import Shimmer from '../Shimmer';
|
|
5
|
+
import defaultClasses from './newsletter.module.css';
|
|
6
|
+
import defaultShimmerClasses from './newsletter.shimmer.module.css';
|
|
7
|
+
|
|
8
|
+
const NewsletterShimmer = props => {
|
|
9
|
+
const classes = useStyle(
|
|
10
|
+
defaultClasses,
|
|
11
|
+
defaultShimmerClasses,
|
|
12
|
+
props.classes
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={classes.root}>
|
|
17
|
+
<Shimmer
|
|
18
|
+
key="title"
|
|
19
|
+
classes={{
|
|
20
|
+
root_rectangle: classes.shimmerItem
|
|
21
|
+
}}
|
|
22
|
+
/>
|
|
23
|
+
<Shimmer
|
|
24
|
+
key="text"
|
|
25
|
+
classes={{
|
|
26
|
+
root_rectangle: classes.shimmerParagraphLine
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
<Shimmer
|
|
30
|
+
key="text2"
|
|
31
|
+
width="50%"
|
|
32
|
+
classes={{
|
|
33
|
+
root_rectangle: classes.shimmerItem
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
<div className={classes.form}>
|
|
37
|
+
<Shimmer type="textInput" />
|
|
38
|
+
<div className={classes.buttonsContainer}>
|
|
39
|
+
<Shimmer type="button" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default NewsletterShimmer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.shimmerItem {
|
|
2
|
+
composes: root_rectangle from '../Shimmer/shimmer.module.css';
|
|
3
|
+
display: block;
|
|
4
|
+
margin-bottom: 1rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.shimmerParagraphLine {
|
|
8
|
+
composes: root_rectangle from '../Shimmer/shimmer.module.css';
|
|
9
|
+
display: block;
|
|
10
|
+
margin-bottom: 0.5rem;
|
|
11
|
+
}
|
|
@@ -30,6 +30,7 @@ exports[`should render properly 1`] = `
|
|
|
30
30
|
<div>
|
|
31
31
|
<span>
|
|
32
32
|
<mock-FormattedMessage
|
|
33
|
+
defaultMessage="<strong>Tracking number:</strong> {number}"
|
|
33
34
|
id="orderDetails.trackingInformation"
|
|
34
35
|
values={
|
|
35
36
|
Object {
|
|
@@ -41,6 +42,7 @@ exports[`should render properly 1`] = `
|
|
|
41
42
|
</span>
|
|
42
43
|
<span>
|
|
43
44
|
<mock-FormattedMessage
|
|
45
|
+
defaultMessage="<strong>Tracking number:</strong> {number}"
|
|
44
46
|
id="orderDetails.trackingInformation"
|
|
45
47
|
values={
|
|
46
48
|
Object {
|
|
@@ -52,6 +54,7 @@ exports[`should render properly 1`] = `
|
|
|
52
54
|
</span>
|
|
53
55
|
<span>
|
|
54
56
|
<mock-FormattedMessage
|
|
57
|
+
defaultMessage="<strong>Tracking number:</strong> {number}"
|
|
55
58
|
id="orderDetails.trackingInformation"
|
|
56
59
|
values={
|
|
57
60
|
Object {
|
|
@@ -30,7 +30,10 @@ const BillingInformation = props => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<div
|
|
33
|
+
<div
|
|
34
|
+
className={classes.root}
|
|
35
|
+
data-cy="OrderDetails-BillingInformation-root"
|
|
36
|
+
>
|
|
34
37
|
<div className={classes.heading}>
|
|
35
38
|
<FormattedMessage
|
|
36
39
|
id="orderDetails.billingInformationLabel"
|
|
@@ -17,7 +17,7 @@ const PaymentMethod = props => {
|
|
|
17
17
|
const [{ name }] = data;
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<div className={classes.root}>
|
|
20
|
+
<div className={classes.root} data-cy="OrderDetails-PaymentMethod-root">
|
|
21
21
|
<div className={classes.heading}>
|
|
22
22
|
<FormattedMessage
|
|
23
23
|
id="orderDetails.paymentMethodLabel"
|
|
@@ -52,7 +52,10 @@ const ShippingInformation = props => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
className={classes.root}
|
|
57
|
+
data-cy="OrderDetails-ShippingInformation-root"
|
|
58
|
+
>
|
|
56
59
|
<div className={classes.heading}>
|
|
57
60
|
<FormattedMessage
|
|
58
61
|
id="orderDetails.shippingInformationLabel"
|
|
@@ -23,6 +23,7 @@ const ShippingMethod = props => {
|
|
|
23
23
|
<span className={classes.trackingRow} key={number}>
|
|
24
24
|
<FormattedMessage
|
|
25
25
|
id="orderDetails.trackingInformation"
|
|
26
|
+
defaultMessage="<strong>Tracking number:</strong> {number}"
|
|
26
27
|
values={{
|
|
27
28
|
number,
|
|
28
29
|
strong: chunks => <strong>{chunks}</strong>
|
|
@@ -43,7 +44,10 @@ const ShippingMethod = props => {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
return (
|
|
46
|
-
<div
|
|
47
|
+
<div
|
|
48
|
+
className={classes.root}
|
|
49
|
+
data-cy="OrderDetails-ShippingMethod-root"
|
|
50
|
+
>
|
|
47
51
|
<div className={classes.heading}>
|
|
48
52
|
<FormattedMessage
|
|
49
53
|
id="orderDetails.shippingMethodLabel"
|
|
@@ -89,7 +89,14 @@ const OrderHistoryPage = props => {
|
|
|
89
89
|
</h3>
|
|
90
90
|
);
|
|
91
91
|
} else {
|
|
92
|
-
return
|
|
92
|
+
return (
|
|
93
|
+
<ul
|
|
94
|
+
className={classes.orderHistoryTable}
|
|
95
|
+
data-cy="OrderHistoryPage-orderHistoryTable"
|
|
96
|
+
>
|
|
97
|
+
{orderRows}
|
|
98
|
+
</ul>
|
|
99
|
+
);
|
|
93
100
|
}
|
|
94
101
|
}, [
|
|
95
102
|
classes.emptyHistoryMessage,
|
|
@@ -11,7 +11,11 @@ const Tile = props => {
|
|
|
11
11
|
const handleClick = useCallback(() => onClick(number), [onClick, number]);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<button
|
|
14
|
+
<button
|
|
15
|
+
className={rootClass}
|
|
16
|
+
onClick={handleClick}
|
|
17
|
+
data-cy={isActive ? 'Tile-activeRoot' : 'Tile-root'}
|
|
18
|
+
>
|
|
15
19
|
{number}
|
|
16
20
|
</button>
|
|
17
21
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`#Boolean renders boolean when data is provided 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
<div>
|
|
6
|
+
Boolean Label
|
|
7
|
+
</div>,
|
|
8
|
+
<div>
|
|
9
|
+
Yes
|
|
10
|
+
</div>,
|
|
11
|
+
]
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`#Boolean renders empty when no data is provided 1`] = `null`;
|
|
15
|
+
|
|
16
|
+
exports[`#Boolean renders label only when data is missing 1`] = `
|
|
17
|
+
<div>
|
|
18
|
+
Boolean Label
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { createTestInstance } from '@magento/peregrine';
|
|
4
|
+
|
|
5
|
+
import Boolean from '../boolean';
|
|
6
|
+
|
|
7
|
+
let inputProps = {};
|
|
8
|
+
|
|
9
|
+
const Component = () => {
|
|
10
|
+
return <Boolean {...inputProps} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const givenDefaultValues = () => {
|
|
14
|
+
inputProps = {
|
|
15
|
+
attribute_metadata: {
|
|
16
|
+
label: 'Boolean Label'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
describe('#Boolean', () => {
|
|
22
|
+
it('renders empty when no data is provided', () => {
|
|
23
|
+
const tree = createTestInstance(<Component />);
|
|
24
|
+
|
|
25
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('renders label only when data is missing', () => {
|
|
29
|
+
givenDefaultValues();
|
|
30
|
+
const tree = createTestInstance(<Component />);
|
|
31
|
+
|
|
32
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders boolean when data is provided', () => {
|
|
36
|
+
givenDefaultValues();
|
|
37
|
+
inputProps = {
|
|
38
|
+
...inputProps,
|
|
39
|
+
selected_attribute_options: {
|
|
40
|
+
attribute_option: [
|
|
41
|
+
{
|
|
42
|
+
label: 'Yes'
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const tree = createTestInstance(<Component />);
|
|
49
|
+
|
|
50
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
});
|