@magento/venia-ui 9.1.0 → 9.2.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 +22 -7
- 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 +10 -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 +14 -7
- 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 +14 -0
- package/lib/components/Footer/__tests__/footer.spec.js +9 -1
- package/lib/components/Footer/footer.js +14 -7
- 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 +24 -20
- package/lib/components/Gallery/item.js +15 -4
- package/lib/components/Gallery/item.module.css +1 -0
- 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/header.js +1 -1
- package/lib/components/Header/navTrigger.js +1 -0
- package/lib/components/Header/searchTrigger.js +1 -0
- package/lib/components/LegacyMiniCart/cartOptions.gql.js +4 -3
- package/lib/components/LegacyMiniCart/editFormFragment.gql.js +7 -3
- package/lib/components/LegacyMiniCart/kebab.js +1 -0
- 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/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/__tests__/__snapshots__/productList.spec.js.snap +1 -1
- package/lib/components/MiniCart/ProductList/__tests__/productList.spec.js +1 -1
- package/lib/components/MiniCart/ProductList/item.js +5 -2
- package/lib/components/MiniCart/ProductList/productList.js +6 -2
- package/lib/components/MiniCart/__tests__/__snapshots__/miniCart.spec.js.snap +1 -1
- package/lib/components/MiniCart/miniCart.gql.js +3 -2
- 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 +14 -8
- package/lib/components/Newsletter/__tests__/newsletter.shimmer.spec.js +10 -0
- package/lib/components/Newsletter/__tests__/newsletter.spec.js +25 -2
- package/lib/components/Newsletter/newsletter.js +27 -6
- 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 +55 -0
- package/lib/components/ProductFullDetail/CustomAttributes/__tests__/customAttributes.spec.js +77 -0
- package/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +68 -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 +3 -0
- package/lib/components/SearchBar/searchBar.js +1 -1
- 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 +41 -1
- package/lib/components/SearchPage/__tests__/searchPage.spec.js +8 -0
- package/lib/components/SearchPage/searchPage.js +12 -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 @@
|
|
|
1
|
+
export { default } from './price';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { BrowserPersistence } from '@magento/peregrine/lib/util';
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import PriceComponent from '@magento/venia-ui/lib/components/Price';
|
|
7
|
+
|
|
8
|
+
import defaultClasses from './price.module.css';
|
|
9
|
+
|
|
10
|
+
const storage = new BrowserPersistence();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Custom Attributes Price Type component.
|
|
14
|
+
*
|
|
15
|
+
* @typedef Price
|
|
16
|
+
* @kind functional component
|
|
17
|
+
*
|
|
18
|
+
* @param {props} props React component props
|
|
19
|
+
*
|
|
20
|
+
* @returns {React.Element} A React component that displays a Price Type Product Attribute.
|
|
21
|
+
*/
|
|
22
|
+
const Price = props => {
|
|
23
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
24
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
25
|
+
|
|
26
|
+
// TODO: Get complete price data from GraphQl including currency
|
|
27
|
+
const storeCurrency = storage.getItem('store_view_currency') || 'USD';
|
|
28
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
29
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
30
|
+
) : null;
|
|
31
|
+
const attributeContent = entered_attribute_value.value ? (
|
|
32
|
+
<div className={classes.attributeContent}>
|
|
33
|
+
<PriceComponent
|
|
34
|
+
value={parseInt(entered_attribute_value.value)}
|
|
35
|
+
currencyCode={storeCurrency}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
) : null;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Fragment>
|
|
42
|
+
{attributeLabel}
|
|
43
|
+
{attributeContent}
|
|
44
|
+
</Fragment>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Props for {@link Price}
|
|
50
|
+
*
|
|
51
|
+
* @typedef props
|
|
52
|
+
*
|
|
53
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
54
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
55
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
56
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
57
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
58
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
59
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
60
|
+
*/
|
|
61
|
+
Price.propTypes = {
|
|
62
|
+
classes: shape({
|
|
63
|
+
label: string,
|
|
64
|
+
content: string
|
|
65
|
+
}),
|
|
66
|
+
attribute_metadata: shape({
|
|
67
|
+
label: string
|
|
68
|
+
}),
|
|
69
|
+
entered_attribute_value: shape({
|
|
70
|
+
value: string
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Price;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`#Select renders empty when no data is provided 1`] = `null`;
|
|
4
|
+
|
|
5
|
+
exports[`#Select renders label only when data is missing 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
Select Label
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`#Select renders options with html when data is provided 1`] = `
|
|
12
|
+
Array [
|
|
13
|
+
<div>
|
|
14
|
+
Select Label
|
|
15
|
+
</div>,
|
|
16
|
+
<div>
|
|
17
|
+
<mock-RichContent
|
|
18
|
+
html="<span>Option 1</span>"
|
|
19
|
+
/>
|
|
20
|
+
<mock-RichContent
|
|
21
|
+
html="<span>Option 2</span>"
|
|
22
|
+
/>
|
|
23
|
+
</div>,
|
|
24
|
+
]
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`#Select renders options without html when data is provided 1`] = `
|
|
28
|
+
Array [
|
|
29
|
+
<div>
|
|
30
|
+
Select Label
|
|
31
|
+
</div>,
|
|
32
|
+
<div>
|
|
33
|
+
Option 1, Option 2
|
|
34
|
+
</div>,
|
|
35
|
+
]
|
|
36
|
+
`;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { createTestInstance } from '@magento/peregrine';
|
|
4
|
+
|
|
5
|
+
import Select from '../select';
|
|
6
|
+
|
|
7
|
+
jest.mock('@magento/venia-ui/lib/components/RichContent', () => {
|
|
8
|
+
return props => <mock-RichContent {...props} />;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
let inputProps = {};
|
|
12
|
+
|
|
13
|
+
const Component = () => {
|
|
14
|
+
return <Select {...inputProps} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const givenDefaultValues = () => {
|
|
18
|
+
inputProps = {
|
|
19
|
+
attribute_metadata: {
|
|
20
|
+
label: 'Select Label'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('#Select', () => {
|
|
26
|
+
it('renders empty when no data is provided', () => {
|
|
27
|
+
const tree = createTestInstance(<Component />);
|
|
28
|
+
|
|
29
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders label only when data is missing', () => {
|
|
33
|
+
givenDefaultValues();
|
|
34
|
+
const tree = createTestInstance(<Component />);
|
|
35
|
+
|
|
36
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders options without html when data is provided', () => {
|
|
40
|
+
inputProps = {
|
|
41
|
+
attribute_metadata: {
|
|
42
|
+
label: 'Select Label',
|
|
43
|
+
ui_input: {
|
|
44
|
+
is_html_allowed: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
selected_attribute_options: {
|
|
48
|
+
attribute_option: [
|
|
49
|
+
{
|
|
50
|
+
label: 'Option 1'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: 'Option 2'
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const tree = createTestInstance(<Component />);
|
|
60
|
+
|
|
61
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('renders options with html when data is provided', () => {
|
|
65
|
+
inputProps = {
|
|
66
|
+
attribute_metadata: {
|
|
67
|
+
label: 'Select Label',
|
|
68
|
+
ui_input: {
|
|
69
|
+
is_html_allowed: true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
selected_attribute_options: {
|
|
73
|
+
attribute_option: [
|
|
74
|
+
{
|
|
75
|
+
label: '<span>Option 1</span>'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: '<span>Option 2</span>'
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const tree = createTestInstance(<Component />);
|
|
85
|
+
|
|
86
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './select';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { arrayOf, bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './select.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Select Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Select
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Select Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Select = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, selected_attribute_options = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
if (selected_attribute_options.attribute_option?.length > 0) {
|
|
29
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
const options = selected_attribute_options.attribute_option.map(
|
|
33
|
+
(option, key) => {
|
|
34
|
+
return (
|
|
35
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
36
|
+
<RichContent key={key} html={option.label} />
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
attributeContent = (
|
|
42
|
+
<div className={classes.contentHtml}>{options}</div>
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
const options = selected_attribute_options.attribute_option
|
|
46
|
+
.map(option => option.label)
|
|
47
|
+
.join(', ');
|
|
48
|
+
|
|
49
|
+
attributeContent = <div className={classes.content}>{options}</div>;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Fragment>
|
|
55
|
+
{attributeLabel}
|
|
56
|
+
{attributeContent}
|
|
57
|
+
</Fragment>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for {@link Select}
|
|
63
|
+
*
|
|
64
|
+
* @typedef props
|
|
65
|
+
*
|
|
66
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
67
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
68
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
69
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
70
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
71
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
72
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
73
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
74
|
+
* @property {Object} selected_attribute_options An object containing the attribute selected options
|
|
75
|
+
* @property {Array} selected_attribute_options.attribute_option An array of the selected options
|
|
76
|
+
* @property {String} selected_attribute_options.attribute_option.label Label of the selected option
|
|
77
|
+
*/
|
|
78
|
+
Select.propTypes = {
|
|
79
|
+
classes: shape({
|
|
80
|
+
label: string,
|
|
81
|
+
content: string,
|
|
82
|
+
contentHtml: string
|
|
83
|
+
}),
|
|
84
|
+
attribute_metadata: shape({
|
|
85
|
+
label: string,
|
|
86
|
+
ui_input: shape({
|
|
87
|
+
is_html_allowed: bool
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
selected_attribute_options: shape({
|
|
91
|
+
attribute_option: arrayOf(
|
|
92
|
+
shape({
|
|
93
|
+
label: string
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Select;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`#Text renders empty when no data is provided 1`] = `null`;
|
|
4
|
+
|
|
5
|
+
exports[`#Text renders label only when data is missing 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
Text Label
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`#Text renders text with html when data is provided 1`] = `
|
|
12
|
+
Array [
|
|
13
|
+
<div>
|
|
14
|
+
Text Label
|
|
15
|
+
</div>,
|
|
16
|
+
<div>
|
|
17
|
+
<mock-RichContent
|
|
18
|
+
html="<div>Text</div>"
|
|
19
|
+
/>
|
|
20
|
+
</div>,
|
|
21
|
+
]
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`#Text renders text without html when data is provided 1`] = `
|
|
25
|
+
Array [
|
|
26
|
+
<div>
|
|
27
|
+
Text Label
|
|
28
|
+
</div>,
|
|
29
|
+
<div>
|
|
30
|
+
Text
|
|
31
|
+
</div>,
|
|
32
|
+
]
|
|
33
|
+
`;
|
package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/__tests__/text.spec.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { createTestInstance } from '@magento/peregrine';
|
|
4
|
+
|
|
5
|
+
import Text from '../text';
|
|
6
|
+
|
|
7
|
+
jest.mock('@magento/venia-ui/lib/components/RichContent', () => {
|
|
8
|
+
return props => <mock-RichContent {...props} />;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
let inputProps = {};
|
|
12
|
+
|
|
13
|
+
const Component = () => {
|
|
14
|
+
return <Text {...inputProps} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const givenDefaultValues = () => {
|
|
18
|
+
inputProps = {
|
|
19
|
+
attribute_metadata: {
|
|
20
|
+
label: 'Text Label'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('#Text', () => {
|
|
26
|
+
it('renders empty when no data is provided', () => {
|
|
27
|
+
const tree = createTestInstance(<Component />);
|
|
28
|
+
|
|
29
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders label only when data is missing', () => {
|
|
33
|
+
givenDefaultValues();
|
|
34
|
+
const tree = createTestInstance(<Component />);
|
|
35
|
+
|
|
36
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders text without html when data is provided', () => {
|
|
40
|
+
inputProps = {
|
|
41
|
+
attribute_metadata: {
|
|
42
|
+
label: 'Text Label',
|
|
43
|
+
ui_input: {
|
|
44
|
+
is_html_allowed: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
entered_attribute_value: {
|
|
48
|
+
value: 'Text'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const tree = createTestInstance(<Component />);
|
|
53
|
+
|
|
54
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders text with html when data is provided', () => {
|
|
58
|
+
inputProps = {
|
|
59
|
+
attribute_metadata: {
|
|
60
|
+
label: 'Text Label',
|
|
61
|
+
ui_input: {
|
|
62
|
+
is_html_allowed: true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
entered_attribute_value: {
|
|
66
|
+
value: '<div>Text</div>'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const tree = createTestInstance(<Component />);
|
|
71
|
+
|
|
72
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './text';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './text.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Text Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Text
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Text Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Text = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
if (entered_attribute_value.value) {
|
|
29
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
33
|
+
attributeContent = (
|
|
34
|
+
<div className={classes.contentHtml}>
|
|
35
|
+
<RichContent html={entered_attribute_value.value} />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
attributeContent = (
|
|
40
|
+
<div className={classes.content}>
|
|
41
|
+
{entered_attribute_value.value}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Fragment>
|
|
49
|
+
{attributeLabel}
|
|
50
|
+
{attributeContent}
|
|
51
|
+
</Fragment>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for {@link Text}
|
|
57
|
+
*
|
|
58
|
+
* @typedef props
|
|
59
|
+
*
|
|
60
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
61
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
62
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
63
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
64
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
65
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
66
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
67
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
68
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
69
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
70
|
+
*/
|
|
71
|
+
Text.propTypes = {
|
|
72
|
+
classes: shape({
|
|
73
|
+
label: string,
|
|
74
|
+
content: string,
|
|
75
|
+
contentHtml: string
|
|
76
|
+
}),
|
|
77
|
+
attribute_metadata: shape({
|
|
78
|
+
label: string,
|
|
79
|
+
ui_input: shape({
|
|
80
|
+
is_html_allowed: bool
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
entered_attribute_value: shape({
|
|
84
|
+
value: string
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default Text;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`#Textarea renders empty when no data is provided 1`] = `null`;
|
|
4
|
+
|
|
5
|
+
exports[`#Textarea renders label only when data is missing 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
Textarea Label
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`#Textarea renders textarea with html when data is provided 1`] = `
|
|
12
|
+
Array [
|
|
13
|
+
<div>
|
|
14
|
+
Textarea Label
|
|
15
|
+
</div>,
|
|
16
|
+
<div>
|
|
17
|
+
<mock-RichContent
|
|
18
|
+
html="<div>Textarea</div>"
|
|
19
|
+
/>
|
|
20
|
+
</div>,
|
|
21
|
+
]
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`#Textarea renders textarea without html when data is provided 1`] = `
|
|
25
|
+
Array [
|
|
26
|
+
<div>
|
|
27
|
+
Textarea Label
|
|
28
|
+
</div>,
|
|
29
|
+
<div>
|
|
30
|
+
Textarea
|
|
31
|
+
</div>,
|
|
32
|
+
]
|
|
33
|
+
`;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { createTestInstance } from '@magento/peregrine';
|
|
4
|
+
|
|
5
|
+
import Textarea from '../textarea';
|
|
6
|
+
|
|
7
|
+
jest.mock('@magento/venia-ui/lib/components/RichContent', () => {
|
|
8
|
+
return props => <mock-RichContent {...props} />;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
let inputProps = {};
|
|
12
|
+
|
|
13
|
+
const Component = () => {
|
|
14
|
+
return <Textarea {...inputProps} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const givenDefaultValues = () => {
|
|
18
|
+
inputProps = {
|
|
19
|
+
attribute_metadata: {
|
|
20
|
+
label: 'Textarea Label'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('#Textarea', () => {
|
|
26
|
+
it('renders empty when no data is provided', () => {
|
|
27
|
+
const tree = createTestInstance(<Component />);
|
|
28
|
+
|
|
29
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders label only when data is missing', () => {
|
|
33
|
+
givenDefaultValues();
|
|
34
|
+
const tree = createTestInstance(<Component />);
|
|
35
|
+
|
|
36
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders textarea without html when data is provided', () => {
|
|
40
|
+
inputProps = {
|
|
41
|
+
attribute_metadata: {
|
|
42
|
+
label: 'Textarea Label',
|
|
43
|
+
ui_input: {
|
|
44
|
+
is_html_allowed: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
entered_attribute_value: {
|
|
48
|
+
value: 'Textarea'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const tree = createTestInstance(<Component />);
|
|
53
|
+
|
|
54
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders textarea with html when data is provided', () => {
|
|
58
|
+
inputProps = {
|
|
59
|
+
attribute_metadata: {
|
|
60
|
+
label: 'Textarea Label',
|
|
61
|
+
ui_input: {
|
|
62
|
+
is_html_allowed: true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
entered_attribute_value: {
|
|
66
|
+
value: '<div>Textarea</div>'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const tree = createTestInstance(<Component />);
|
|
71
|
+
|
|
72
|
+
expect(tree.toJSON()).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './textarea';
|