Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6d7ba25
Added react-i18next and configured, deleted i18n service
clicktronix Feb 5, 2019
d2cbef4
Mvp-base merged. Conflicts resolved
clicktronix Feb 5, 2019
5af28dc
Shrinkwrap updated
clicktronix Feb 5, 2019
6d93ac9
react-i18next moved at /services, react updated
clicktronix Feb 9, 2019
3f3916f
Fixed reat hot loader flow for i18n
clicktronix Feb 9, 2019
7e5b9ae
Deleted i18n export
clicktronix Feb 9, 2019
c3d3826
Master merged, conflicts resolved
clicktronix Mar 24, 2019
3c93486
Dirty commit
clicktronix Mar 28, 2019
ebf0443
Added translations for components
clicktronix Mar 31, 2019
4dd615d
Added styles for selector, added plural translates
clicktronix Mar 31, 2019
15ea3fc
Conflicts resolved
clicktronix Mar 31, 2019
8298d8e
Translates added
clicktronix Mar 31, 2019
d0395a9
Imports changed at client
clicktronix Apr 1, 2019
b152c95
Tests fixed for new localization
clicktronix Apr 1, 2019
6162f64
Master merged, conflicts resolved
clicktronix Apr 5, 2019
410b2fd
Changed SearchForm props for localization
clicktronix Apr 5, 2019
6980146
Tests fixed
clicktronix Apr 5, 2019
a16adce
Added memo menu items
clicktronix Apr 5, 2019
b91a7d3
Changed Lang type value
clicktronix Apr 5, 2019
e828e62
Translates updated
clicktronix Apr 5, 2019
5ae5065
Updated translations
clicktronix Apr 5, 2019
6bc4819
Conflicts resolved
clicktronix Apr 6, 2019
2bbe72c
Labels translations moved from constants
clicktronix Apr 6, 2019
8705488
Lang selector tested
clicktronix Apr 7, 2019
71466ed
Memoization fixed
clicktronix Apr 8, 2019
baeac91
Translates updated
clicktronix Apr 8, 2019
3a0ec63
Replaced lang selector by mui
clicktronix Apr 8, 2019
93db822
I18n packages updated
clicktronix Apr 8, 2019
dc13c51
Merge branch '63-react-18next-configure' into 103-localization-tests
clicktronix Apr 8, 2019
4c0e46a
Tests fixed with new mui select, jest downgraded
clicktronix Apr 8, 2019
6aa12f2
Validators changed for work with localization
clicktronix Apr 8, 2019
7aca1d2
Code refactored
clicktronix Apr 9, 2019
f9a4780
Changed filter lables for repos values
clicktronix Apr 9, 2019
c9ae97f
Changed i18n init implementation
clicktronix Apr 9, 2019
1c7cc85
Renamed features translation at components
clicktronix Apr 9, 2019
3dfaad7
Added validation error translations
clicktronix Apr 10, 2019
290530f
i18next added at tslint imports black list
clicktronix Apr 10, 2019
fc7845b
Merge branch 'master' into 63-react-18next-configure
clicktronix Apr 10, 2019
a42aff6
Merge branch '63-react-18next-configure' into 103-localization-tests
clicktronix Apr 10, 2019
18f7f9e
Master merged. Conflicts resolved
clicktronix May 24, 2019
3df7c26
Errors fixed
clicktronix May 24, 2019
245e471
Updated jest config, deleted deprecated, updated locale mock props
clicktronix May 24, 2019
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
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
setupTestFrameworkScriptFile: '<rootDir>/jest.setup.ts',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],

transform: {
'^.+\\.tsx?$': 'ts-jest',
Expand All @@ -21,7 +21,6 @@ module.exports = {
'ContainersProvider\.tsx$': '<rootDir>/src/core/__mocks__/fileMock.ts',
},

mapCoverage: true,
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: [
'**/src/**/*.{ts,tsx}',
Expand Down
240 changes: 240 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions src/services/i18n/view/LanguageSelector/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { makeShallowRenderer, getMockedLocaleProps } from 'shared/helpers';
import { ITranslationProps } from 'services/i18n';
import { Select } from 'shared/view/elements';

import { LanguageSelector } from '../LanguageSelector';

const props: ITranslationProps = {
...getMockedLocaleProps(),
};

const getComponent = makeShallowRenderer(LanguageSelector, props);

describe('(services/i18n) LanguageSelector component', () => {
it('should render one Select', () => {
const component = getComponent();
expect(component.find(Select).length).toEqual(1);
});

it('should call changeLanguage', () => {
const changeLanguage = jest.fn();
const newProps = {
...props,
i18n: {
...props.i18n,
changeLanguage,
},
};
const component = getComponent(newProps);

component.find(Select).simulate('change', { target: { value: 'ru-RU' } });

expect(changeLanguage).toBeCalledTimes(1);
expect(changeLanguage).toBeCalledWith('ru-RU');
});

it('should render select with en-US default language', () => {
const component = getComponent();

expect(component.find(Select).props().value).toEqual('en-US');
});

it('should get correct options', () => {
const expectedOptions = [{
label: 'English', value: 'en-US',
}, {
label: 'Русский', value: 'ru-RU',
}];
const component = getComponent();
const select = component.find(Select);

expect(select.props().options).toEqual(expectedOptions);
});
});
4 changes: 2 additions & 2 deletions src/shared/helpers/tests/mockLocaleProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const getMockedLocaleProps: () => ITranslationProps = () => ({
tReady: true,
i18n: {
isInitialized: true,
language: 'en',
languages: ['en', 'ru'],
language: 'en-US',
languages: ['en-US', 'ru-RU'],
options: {},
services: {
backendConnector: {},
Expand Down