Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for user/pages folder #3307

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions client/i18n.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import Backend from 'i18next-http-backend';

import {
be,
enUS,
@@ -20,8 +19,9 @@ import {
tr,
enIN
} from 'date-fns/locale';
import translations from '../translations/locales/en-US/translations.json';

const fallbackLng = ['en-US'];
// Remove unused fallbackLng variable since it's hardcoded in i18n.init()

export const availableLanguages = [
'be',
@@ -104,19 +104,17 @@ i18n
// .use(LanguageDetector)// to detect the language from currentBrowser
.use(Backend) // to fetch the data from server
.init({
resources: {
'en-US': {
translation: translations
}
},
lng: 'en-US',
fallbackLng, // if user computer language is not on the list of available languages, than we will be using the fallback language specified earlier
debug: false,
backend: options,
getAsync: false,
initImmediate: false,
useSuspense: true,
whitelist: availableLanguages,
fallbackLng: 'en-US',
interpolation: {
escapeValue: false // react already safes from xss
escapeValue: false
},
saveMissing: false, // if a key is not found AND this flag is set to true, i18next will call the handler missingKeyHandler
missingKeyHandler: false // function(lng, ns, key, fallbackValue) { } custom logic about how to handle the missing keys
backend: options // Add options to Backend configuration
});

export default i18n;
57 changes: 43 additions & 14 deletions client/modules/User/pages/AccountView.jsx
Original file line number Diff line number Diff line change
@@ -75,30 +75,59 @@ function AccountView() {

<main className="account-settings">
<header className="account-settings__header">
<h1 className="account-settings__title">
<h1
className="account-settings__title"
data-testid="account-settings-title"
>
{t('AccountView.Settings')}
</h1>
</header>
{accessTokensUIEnabled && (
<Tabs className="account__tabs">
<TabList>
<Tabs
className="account__tabs"
defaultIndex={0}
selectedTabClassName="tabs__tab--selected"
>
<TabList className="tabs__list">
<div className="tabs__titles">
<Tab>
<h4 className="tabs__title">{t('AccountView.AccountTab')}</h4>
<Tab
className="tabs__tab"
selectedClassName="tabs__tab--selected"
role="tab"
aria-selected="true"
aria-controls="account-panel"
aria-label="Account"
>
<h4 className="tabs__title">
{t('AccountView.AccountTab', 'Account')}
</h4>
</Tab>
<Tab
className="tabs__tab"
selectedClassName="tabs__tab--selected"
role="tab"
aria-selected="false"
aria-controls="access-tokens-panel"
aria-label="Access Tokens"
>
<h4 className="tabs__title">
{t('AccountView.AccessTokensTab', 'Access Tokens')}
</h4>
</Tab>
{accessTokensUIEnabled && (
<Tab>
<h4 className="tabs__title">
{t('AccountView.AccessTokensTab')}
</h4>
</Tab>
)}
</div>
</TabList>
<TabPanel>
<TabPanel
id="account-panel"
role="tabpanel"
className="tabs__panel"
>
<SocialLoginPanel />
</TabPanel>
<TabPanel>
<TabPanel
id="access-tokens-panel"
role="tabpanel"
className="tabs__panel"
>
<APIKeyForm />
</TabPanel>
</Tabs>
Loading