Skip to content

Commit

Permalink
(fix) O3-2734: Fix user menu tooltip and toast notification descripti…
Browse files Browse the repository at this point in the history
…on (#880)

* fix: fix user arial label and user menu name

* fix: fix tests

* fix: fix translations

* refactor: add user menu tooltip translation

* Update E2E test

---------

Co-authored-by: Dennis Kigen <[email protected]>
  • Loading branch information
usamaidrsk and denniskigen authored Jan 12, 2024
1 parent 789fc5e commit 6f89ecc
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion e2e/specs/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('Login as Admin user', async ({ page }) => {
});

await test.step('And I should be able to see various elements on the page', async () => {
await page.getByRole('button', { name: 'Users' }).click();
await page.getByRole('button', { name: /user/i }).click();
await expect(page.getByText(/super user/i)).toBeVisible();
await expect(page.getByText(/outpatient clinic/i)).toBeVisible();
await expect(page.getByRole('button', { name: /logout/i })).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function useDefaultLocation(isUpdateFlow: boolean) {
? t('locationPreferenceAdded', 'Selected location will be used for your next logins')
: t('locationPreferenceUpdated', 'Login location preference updated'),
description: !isUpdateFlow
? t('selectedLocationPreferenceSetMessage', 'You can change your preference from the user dashboard')
? t('selectedLocationPreferenceSetMessage', 'You can change your preference from the user menu')
: t('locationPreferenceAdded', 'Selected location will be used for your next logins'),
kind: 'success',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('LocationPicker', () => {
expect(showToast).toHaveBeenCalledWith({
kind: 'success',
title: 'Selected location will be used for your next logins',
description: 'You can change your preference from the user dashboard',
description: 'You can change your preference from the user menu',
}),
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "Search for a location",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "Select your location from the list below. Use the search bar to find your location.",
"submitting": "Submitting",
"username": "Username",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "ابحث عن موقع",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "اختر موقعك من القائمة أدناه. استخدم شريط البحث للعثور على موقعك.",
"submitting": "جار الإرسال",
"username": "اسم المستخدم",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "Search for a location",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "Select your location from the list below. Use the search bar to find your location.",
"submitting": "Submitting",
"username": "Username",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "Buscar una ubicación",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "Selecciona tu ubicación de la lista de abajo. Utiliza la barra de búsqueda para encontrar tu ubicación.",
"submitting": "Enviando",
"username": "Nombre de usuario",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "Rechercher un emplacement",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "Sélectionnez votre emplacement dans la liste ci-dessous. Utilisez la barre de recherche pour rechercher votre emplacement.",
"submitting": "Submitting",
"username": "Nom d'utilisateur",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/esm-login-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"rememberLocationForFutureLogins": "Remember my location for future logins",
"removedLoginLocationPreference": "The login location preference has been removed.",
"searchForLocation": "חיפוש מיקום",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user dashboard",
"selectedLocationPreferenceSetMessage": "You can change your preference from the user menu",
"selectYourLocation": "בחר את המיקום שלך מהרשימה למטה. השתמש בשורת החיפוש לחיפוש המיקום שלך.",
"submitting": "Submitting",
"username": "שם משתמש",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import OfflineBanner from '../offline-banner/offline-banner.component';
import UserMenuPanel from '../navbar-header-panels/user-menu-panel.component';
import SideMenuPanel from '../navbar-header-panels/side-menu-panel.component';
import styles from './navbar.scss';
import { useTranslation } from 'react-i18next';

const HeaderItems: React.FC = () => {
const { t } = useTranslation();
const config = useConfig();
const [activeHeaderPanel, setActiveHeaderPanel] = useState<string>(null);
const layout = useLayoutType();
Expand Down Expand Up @@ -75,14 +77,14 @@ const HeaderItems: React.FC = () => {
/>
{showUserMenu && (
<HeaderGlobalAction
aria-label="Users"
aria-label={t('userMenuTooltip', 'User')}
aria-labelledby="Users Avatar Icon"
className={classNames({
[styles.headerGlobalBarButton]: isActivePanel('userMenu'),
[styles.activePanel]: !isActivePanel('userMenu'),
})}
enterDelayMs={500}
name="Users"
name="User"
isActive={isActivePanel('userMenu')}
onClick={(event) => {
togglePanel('userMenu');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Root', () => {
it('should display navbar with title', async () => {
render(<Root />);

expect(screen.getByRole('button', { name: /users/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /user/i })).toBeInTheDocument();
expect(screen.getByRole('banner', { name: /openmrs/i })).toBeInTheDocument();
expect(screen.getByText(/mock emr/i)).toBeInTheDocument();
});
Expand All @@ -61,7 +61,7 @@ describe('Root', () => {

render(<Root />);

const userButton = screen.getByRole('button', { name: /users/i });
const userButton = screen.getByRole('button', { name: /user/i });
await user.click(userButton);
expect(screen.getByLabelText(/location/i)).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancel",
"change": "Change",
"changeLanguage": "Change Language",
"notifications": "Notifications"
"notifications": "Notifications",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancel",
"change": "تغيير",
"changeLanguage": "Change Language",
"notifications": "الإشعارات"
"notifications": "الإشعارات",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancel",
"change": "Change",
"changeLanguage": "Change Language",
"notifications": "Notifications"
"notifications": "Notifications",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancelar",
"change": "Cambiar",
"changeLanguage": "Cambiar idioma",
"notifications": "Notificaciones"
"notifications": "Notificaciones",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Annuler",
"change": "Changer",
"changeLanguage": "Changer de langue",
"notifications": "Notifications"
"notifications": "Notifications",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancel",
"change": "שינוי",
"changeLanguage": "Change Language",
"notifications": "התראות"
"notifications": "התראות",
"userMenuTooltip": "User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"cancel": "Cancel",
"change": "ផ្លាស់ប្តូរ",
"changeLanguage": "Change Language",
"notifications": "ការជូនដំណឹង"
"notifications": "ការជូនដំណឹង",
"userMenuTooltip": "User"
}

0 comments on commit 6f89ecc

Please sign in to comment.