---
.../FilterList/__tests__/filterDefault.spec.js | 17 ++++++++++++++++-
.../FilterModal/FilterList/filterDefault.js | 14 +++++++++++++-
.../FilterModal/FilterList/filterItem.js | 1 +
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/packages/venia-ui/lib/components/FilterModal/FilterList/__tests__/filterDefault.spec.js b/packages/venia-ui/lib/components/FilterModal/FilterList/__tests__/filterDefault.spec.js
index 0cf9c194747..edca810798b 100644
--- a/packages/venia-ui/lib/components/FilterModal/FilterList/__tests__/filterDefault.spec.js
+++ b/packages/venia-ui/lib/components/FilterModal/FilterList/__tests__/filterDefault.spec.js
@@ -1,12 +1,16 @@
import React from 'react';
import { createTestInstance } from '@magento/peregrine';
-
+import { useCurrencySwitcher } from '@magento/peregrine/lib/talons/Header/useCurrencySwitcher';
import Checkbox from '../../../Checkbox';
import FilterDefault from '../filterDefault';
jest.mock('../../../Checkbox', () => props => );
+jest.mock('@magento/peregrine/lib/talons/Header/useCurrencySwitcher', () => ({
+ useCurrencySwitcher: jest.fn()
+}));
+
const mockLabel = 'Item Label';
let inputProps = {};
@@ -22,6 +26,16 @@ const givenDefaultValues = () => {
};
};
+const talonProps = {
+ handleSwitchCurrency: jest.fn(),
+ availableCurrencies: ['USD', 'EUR'],
+ currentCurrencyCode: 'EUR',
+ currencyMenuRef: {},
+ currencyMenuTriggerRef: {},
+ currencyMenuIsOpen: false,
+ handleTriggerClick: jest.fn()
+};
+
const givenWithItem = () => {
inputProps = {
...inputProps,
@@ -42,6 +56,7 @@ const givenWithSelectedItem = () => {
describe('#FilterDefault', () => {
beforeEach(() => {
givenDefaultValues();
+ useCurrencySwitcher.mockReturnValueOnce(talonProps);
});
it('renders without item', () => {
diff --git a/packages/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js b/packages/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js
index dacfc1d7013..cf1ad6b9a9e 100644
--- a/packages/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js
+++ b/packages/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js
@@ -5,6 +5,7 @@ import { bool, shape, string } from 'prop-types';
import Checkbox from '../../Checkbox';
import { useStyle } from '../../../classify';
import defaultClasses from './filterDefault.module.css';
+import { useCurrencySwitcher } from '@magento/peregrine/lib/talons/Header/useCurrencySwitcher';
const FilterDefault = props => {
const {
@@ -12,11 +13,22 @@ const FilterDefault = props => {
isSelected,
item,
onMouseDown,
+ group,
...restProps
} = props;
const { label, value_index } = item || {};
const classes = useStyle(defaultClasses, propsClasses);
+ const { currentCurrencyCode } = useCurrencySwitcher();
+ const currencySymbolMap = {
+ USD: '$',
+ EUR: '€'
+ };
+ const title =
+ group === 'price'
+ ? currencySymbolMap[currentCurrencyCode] +
+ label.replace('-', ' - ' + currencySymbolMap[currentCurrencyCode])
+ : label;
const { formatMessage } = useIntl();
const ariaLabel = !isSelected
@@ -44,7 +56,7 @@ const FilterDefault = props => {
classes={classes}
field={`${label}-${value_index}`}
fieldValue={!!isSelected}
- label={label}
+ label={title}
ariaLabel={ariaLabel}
data-cy="FilterDefault-checkbox"
onClick={onMouseDown}
diff --git a/packages/venia-ui/lib/components/FilterModal/FilterList/filterItem.js b/packages/venia-ui/lib/components/FilterModal/FilterList/filterItem.js
index 3aa926f5f1e..686bd54f113 100644
--- a/packages/venia-ui/lib/components/FilterModal/FilterList/filterItem.js
+++ b/packages/venia-ui/lib/components/FilterModal/FilterList/filterItem.js
@@ -52,6 +52,7 @@ const FilterItem = props => {
item={tileItem}
onMouseDown={handleClick}
onKeyDown={handleKeyDown}
+ group={group}
title={title}
value={value}
/>
From 457bd2fae13345ea09a1db372939f985ee9672be Mon Sep 17 00:00:00 2001
From: glo80771 <127736464+glo80771@users.noreply.github.com>
Date: Wed, 4 Oct 2023 17:15:09 +0530
Subject: [PATCH 7/7] =?UTF-8?q?PWA-3182::Accessibility=20||=20screen=20rea?=
=?UTF-8?q?der=20reading=20wrong=20quantity=20into=E2=80=A6=20(#4172)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* PWA-3182::Accessibility || srcreen reader reading wrong quantity into sub-folder of My account even when havnig atleast 1 item or more or zero
* PWA-3182::Updated unit test cases
---------
Co-authored-by: arpit khare <84493875+glo42707@users.noreply.github.com>
Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com>
---
packages/venia-ui/i18n/en_US.json | 4 ++
.../accountInformationPage.spec.js.snap | 4 +-
.../accountInformationPage.js | 4 +-
.../addressBookPage.spec.js.snap | 24 ++++++--
.../AddressBookPage/addressBookPage.js | 14 ++++-
.../communicationsPage.spec.js.snap | 16 ++---
.../CommunicationsPage/communicationsPage.js | 4 +-
.../orderHistoryPage.spec.js.snap | 40 +++++++++----
.../OrderHistoryPage/orderHistoryPage.js | 15 ++++-
.../savedPaymentsPage.spec.js.snap | 16 +++--
.../SavedPaymentsPage/savedPaymentsPage.js | 22 ++++++-
.../__snapshots__/wishlistPage.spec.js.snap | 60 ++++++++++++++-----
.../__tests__/wishlistPage.spec.js | 13 ++--
.../components/WishlistPage/wishlistPage.js | 13 +++-
14 files changed, 187 insertions(+), 62 deletions(-)
diff --git a/packages/venia-ui/i18n/en_US.json b/packages/venia-ui/i18n/en_US.json
index a9913069f58..d4bdea399e8 100644
--- a/packages/venia-ui/i18n/en_US.json
+++ b/packages/venia-ui/i18n/en_US.json
@@ -27,6 +27,7 @@
"addressBookPage.addressBookText": "Address Book",
"addressBookPage.editDialogTitle": "Edit Address",
"addressBookPage.makeDefaultAddress": "Make this my default address",
+ "addressBookPage.addAddressMessage": "You have added {count} address in your address book.",
"addressBookPage.telephone": "Phone {telephone}",
"addressCard.defaultText": "Default",
"addToCartButton.addItemToCart": "ADD TO CART",
@@ -309,6 +310,7 @@
"orderHistoryPage.loadMore": "Load More",
"orderHistoryPage.pageInfo": "Showing {current} of {total}",
"orderHistoryPage.pageTitleText": "Order History",
+ "orderHistoryPage.ordersCount": "You have {count} orders in your history",
"orderHistoryPage.search": "Search by Order Number",
"orderItems.itemsHeading": "Items",
"orderProgressBar.deliveredText": "Delivered",
@@ -393,6 +395,7 @@
"savedPaymentsPage.addButtonText": "Add a credit card",
"savedPaymentsPage.creditCard.errorRemoving": "Something went wrong deleting this payment method. Please refresh and try again.",
"savedPaymentsPage.noSavedPayments": "You have no saved payments.",
+ "savedPaymentsPage.Message": "You have {count} saved payments.",
"savedPaymentsPage.title": "Saved Payments",
"searchBar.heading": "Product Suggestions",
"searchBar.label": " in {label}",
@@ -480,6 +483,7 @@
"wishlistPage.headingText": "{count, plural, one {Favorites List} other {Favorites Lists}}",
"wishlistPage.wishlistDisabledMessage": "The wishlist is not currently available.",
"wishlist.itemCountOpen": "Showing {currentCount} of {count} items in this list",
+ "wishlist.itemsMessage": "You have {count} items in your wishlist",
"wishlist.itemCountClosed": "You have {count} {count, plural, one {item} other {items}} in this list",
"wishlist.loadMore": "Load More",
"LegacyMiniCart.buttonExpanded":"More Options Expanded",
diff --git a/packages/venia-ui/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap b/packages/venia-ui/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap
index 93eb161b2cb..6d2c7af20ef 100644
--- a/packages/venia-ui/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap
+++ b/packages/venia-ui/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap
@@ -5,7 +5,7 @@ exports[`renders form error 1`] = `
className="root"
>
Account Information
-
@@ -13,7 +13,7 @@ exports[`renders form error 1`] = `
defaultMessage="Account Information"
id="accountInformationPage.accountInformation"
/>
-
+
diff --git a/packages/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js b/packages/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js
index 3a108340e70..ba7a1699fb6 100644
--- a/packages/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js
+++ b/packages/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js
@@ -126,7 +126,7 @@ const AccountInformationPage = props => {
defaultMessage: 'Account Information'
})}
-
{
id={'accountInformationPage.accountInformation'}
defaultMessage={'Account Information'}
/>
-
+
{errorMessage ? errorMessage : pageContent}
);
diff --git a/packages/venia-ui/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap b/packages/venia-ui/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap
index 1c0b9e1e2ad..94549f5493d 100644
--- a/packages/venia-ui/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap
+++ b/packages/venia-ui/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap
@@ -5,12 +5,16 @@ exports[`renders correctly when there are existing addresses 1`] = `
className="root"
>
Title
-
Address Book
-
+
+
@@ -125,12 +129,16 @@ exports[`renders correctly when there are no existing addresses 1`] = `
className="root"
>
Title
-
Address Book
-
+
+
@@ -200,12 +208,16 @@ exports[`renders delete confirmation on address that is being deleted 1`] = `
className="root"
>
Title
-
Address Book
-
+
+
diff --git a/packages/venia-ui/lib/components/AddressBookPage/addressBookPage.js b/packages/venia-ui/lib/components/AddressBookPage/addressBookPage.js
index 5b0135b8356..234d6fec228 100644
--- a/packages/venia-ui/lib/components/AddressBookPage/addressBookPage.js
+++ b/packages/venia-ui/lib/components/AddressBookPage/addressBookPage.js
@@ -90,16 +90,26 @@ const AddressBookPage = props => {
return fullPageLoadingIndicator;
}
+ const addressBookPageMessage = formatMessage(
+ {
+ id: 'addressBookPage.addAddressMessage',
+ defaultMessage:
+ 'You have added {count} address in your address book.'
+ },
+ { count: customerAddresses.length }
+ );
+
return (
{PAGE_TITLE}
-
{PAGE_TITLE}
-
+
+
{addressBookElements}
Communications
-
-
+
Communications
-
-
+
Communications
-
-
+
Communications
-
-
+
{
return (
{title}
-
+
-
+
Title
-
Order History
-
+
+
@@ -209,12 +213,16 @@ exports[`renders correctly without data 1`] = `
className="root"
>
Title
-
Order History
-
+
+
@@ -388,12 +396,16 @@ exports[`renders invalid order id message if order id is wrong 1`] = `
className="root"
>
Title
-
Order History
-
+
+
@@ -581,12 +593,16 @@ exports[`renders loading indicator 1`] = `
className="root"
>
Title
-
Order History
-
+
+
@@ -794,12 +810,16 @@ exports[`renders no orders message is orders is empty 1`] = `
className="root"
>
Title
-
Order History
-
+
+
diff --git a/packages/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js b/packages/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js
index 837389c6ece..133d3166549 100644
--- a/packages/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js
+++ b/packages/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js
@@ -56,6 +56,15 @@ const OrderHistoryPage = props => {
id: 'orderHistoryPage.search',
defaultMessage: 'Search by Order Number'
});
+
+ const ordersCountMessage = formatMessage(
+ {
+ id: 'orderHistoryPage.ordersCount',
+ defaultMessage: 'You have {count} orders in your history.'
+ },
+ { count: orders.length }
+ );
+
const classes = useStyle(defaultClasses, props.classes);
const orderRows = useMemo(() => {
@@ -160,9 +169,11 @@ const OrderHistoryPage = props => {
{PAGE_TITLE}
-
+
+
@@ -37,12 +41,16 @@ exports[`renders correctly when there are no existing saved payments 1`] = `
className="root"
>
Title
-
Saved Payments
-
+
+
diff --git a/packages/venia-ui/lib/components/SavedPaymentsPage/savedPaymentsPage.js b/packages/venia-ui/lib/components/SavedPaymentsPage/savedPaymentsPage.js
index 810b5198f69..cb6871ce1e9 100644
--- a/packages/venia-ui/lib/components/SavedPaymentsPage/savedPaymentsPage.js
+++ b/packages/venia-ui/lib/components/SavedPaymentsPage/savedPaymentsPage.js
@@ -48,6 +48,23 @@ const SavedPaymentsPage = props => {
defaultMessage: 'Saved Payments'
});
+ const savedPaymentsMessage = useMemo(() => {
+ if (!savedPayments.length) {
+ return formatMessage({
+ id: 'savedPaymentsPage.noSavedPayments',
+ defaultMessage: 'You have no saved payments.'
+ });
+ } else {
+ return formatMessage(
+ {
+ id: 'savedPaymentsPage.Message',
+ defaultMessage: 'You have {count} saved payments.'
+ },
+ { count: savedPayments.length }
+ );
+ }
+ }, [savedPayments, formatMessage]);
+
if (isLoading) {
return fullPageLoadingIndicator;
}
@@ -55,9 +72,10 @@ const SavedPaymentsPage = props => {
return (
{title}
-
+
{savedPaymentElements}
{noSavedPayments}
diff --git a/packages/venia-ui/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap b/packages/venia-ui/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap
index e29f24e225d..11fae7b752b 100644
--- a/packages/venia-ui/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap
+++ b/packages/venia-ui/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap
@@ -4,23 +4,34 @@ exports[`empty single wishlist 1`] = `
+
`;
@@ -29,10 +40,14 @@ exports[`renders a single wishlist without visibility toggle 1`] = `
-
+
-
+
@@ -93,20 +113,24 @@ exports[`renders general fetch error 1`] = `
@@ -206,10 +230,14 @@ exports[`renders wishlist data 1`] = `
{
{ graphQLErrors: [{ message: 'Ruh roh!' }] }
]
]),
- wishlists: []
+ wishlists: [{ id: 1, name: 'Favorites', items_count: 1 }]
});
const tree = createTestInstance();
@@ -49,7 +49,7 @@ test('renders disabled feature error', () => {
}
]
]),
- wishlists: []
+ wishlists: [{ id: 1, name: 'Favorites', items_count: 1 }]
});
const tree = createTestInstance();
@@ -60,7 +60,10 @@ test('renders disabled feature error', () => {
test('renders wishlist data', () => {
useWishlistPage.mockReturnValue({
errors: new Map(),
- wishlists: [{ id: 1, name: 'Favorites' }, { id: 2, name: 'Registry' }]
+ wishlists: [
+ { id: 1, name: 'Favorites', items_count: 1 },
+ { id: 2, name: 'Registry', items_count: 2 }
+ ]
});
const tree = createTestInstance();
@@ -71,7 +74,7 @@ test('renders wishlist data', () => {
test('renders a single wishlist without visibility toggle', () => {
useWishlistPage.mockReturnValue({
errors: new Map(),
- wishlists: [{ id: 1, name: 'Favorites' }]
+ wishlists: [{ id: 1, name: 'Favorites', items_count: 1 }]
});
const tree = createTestInstance();
@@ -82,7 +85,7 @@ test('renders a single wishlist without visibility toggle', () => {
test('empty single wishlist', () => {
useWishlistPage.mockReturnValue({
errors: new Map(),
- wishlists: []
+ wishlists: [{ items_count: 5 }]
});
const tree = createTestInstance();
diff --git a/packages/venia-ui/lib/components/WishlistPage/wishlistPage.js b/packages/venia-ui/lib/components/WishlistPage/wishlistPage.js
index a6bbf5567bb..78841d942bb 100644
--- a/packages/venia-ui/lib/components/WishlistPage/wishlistPage.js
+++ b/packages/venia-ui/lib/components/WishlistPage/wishlistPage.js
@@ -79,13 +79,22 @@ const WishlistPage = props => {
);
}
+ const wishlistMessage = formatMessage(
+ {
+ id: 'wishlist.itemsMessage',
+ defaultMessage: 'You have {count} items in your wishlist.'
+ },
+ { count: wishlists[0].items_count }
+ );
+
return (
-
+
{
'{count, plural, one {Favorites List} other {Favorites Lists}}'
}
/>
-
+
{content}
);