Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

Commit

Permalink
[#932] Tests next step of account recovery is translated
Browse files Browse the repository at this point in the history
  • Loading branch information
Anike Arni committed Mar 28, 2017
1 parent d39f2b2 commit c7d135c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions web-ui/app/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"tip3": "Don't ever ask for it via email.",
"input-label": "type here admin's backup code",
"button": "Next"
},
"user-form": {
"title": "Remember your backup account?"
}
},
"backup-account": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import './admin_recovery_code_form.scss';


export const AdminRecoveryCodeForm = ({ t, next }) => (
<form onSubmit={next}>
<form className='admin-code-form' onSubmit={next}>
<h1>{t('account-recovery.admin-form.title')}</h1>
<ul>
<li>{t('account-recovery.admin-form.tip1')}</li>
Expand Down
19 changes: 19 additions & 0 deletions web-ui/src/account_recovery/forms/user_recovery_code_form.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { shallow } from 'enzyme';
import expect from 'expect';
import React from 'react';
import { UserRecoveryCodeForm } from 'src/account_recovery/forms/user_recovery_code_form';

describe('UserRecoveryCodeForm', () => {
let userRecoveryCodeForm;

beforeEach(() => {
const mockTranslations = key => key;
userRecoveryCodeForm = shallow(
<UserRecoveryCodeForm t={mockTranslations} />
);
});

it('renders title for user recovery code', () => {
expect(userRecoveryCodeForm.find('h1').text()).toEqual('account-recovery.user-form.title');
});
});
9 changes: 8 additions & 1 deletion web-ui/test/integration/translations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ import testI18n from './i18n';

describe('Translations', () => {
context('Account Recovery Page', () => {
it('translates all key', () => {
it('translates all keys on first step', () => {
const app = mount(<App i18n={testI18n} child={<AccountRecoveryPage />} />);
expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text());
});

it('translates all keys on second step', () => {
const app = mount(<App i18n={testI18n} child={<AccountRecoveryPage />} />);
app.find('form.admin-code-form').simulate('submit');

expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text());
});
});
Expand Down

0 comments on commit c7d135c

Please sign in to comment.