From c4a74ad244ac2e568ec86ab3892bb5ef65c32d3e Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Tue, 15 Jan 2019 21:42:41 -0500 Subject: [PATCH] Translating Form component --- src/components/App/__snapshots__/test.js.snap | 30 +++++++++---------- .../Form/__snapshots__/test.js.snap | 14 ++++++--- src/components/Form/index.js | 16 ++++++---- src/components/Form/test.js | 16 +++++----- src/locales/en-AC.yaml | 8 +++++ src/locales/en.yaml | 8 +++++ 6 files changed, 60 insertions(+), 32 deletions(-) diff --git a/src/components/App/__snapshots__/test.js.snap b/src/components/App/__snapshots__/test.js.snap index 42d3d2a..1e7fda7 100644 --- a/src/components/App/__snapshots__/test.js.snap +++ b/src/components/App/__snapshots__/test.js.snap @@ -2,7 +2,7 @@ exports[`App removing rendered expression 1`] = ` -
- + -
- - - - - + -
- + -
-
+ -
- -
+ > + TRANSLATE(Testing JS) + - + placeholder={ t('Enter regular expression to display') }> +
@@ -77,4 +80,5 @@ class Form extends React.PureComponent { } } -export default Form; +export { Form }; +export default withNamespaces()(Form); diff --git a/src/components/Form/test.js b/src/components/Form/test.js index 1675607..93e1220 100644 --- a/src/components/Form/test.js +++ b/src/components/Form/test.js @@ -1,17 +1,19 @@ import React from 'react'; import { shallow } from 'enzyme'; -import Form from 'components/Form'; +import { mockT } from 'i18n'; +import { Form } from 'components/Form'; const syntaxList = [ - { id: 'testJS', name: 'Testing JS' }, - { id: 'other', name: 'Other' } + { id: 'testJS', label: 'Testing JS' }, + { id: 'other', label: 'Other' } ]; +const commonProps = { syntaxList, t: mockT }; describe('Form', () => { test('rendering', () => { const component = shallow( - + Actions ); @@ -22,7 +24,7 @@ describe('Form', () => { test('submitting form', () => { const onSubmit = jest.fn(); const component = shallow( -
+ ); const exprInput = component.find('[name="expr"]'); @@ -52,7 +54,7 @@ describe('Form', () => { test('submitting form with Shift+Enter', () => { const component = shallow( - + ); const form = component.instance(); const eventObj = { @@ -68,7 +70,7 @@ describe('Form', () => { test('not submitting with just Enter', () => { const component = shallow( - + ); const form = component.instance(); const eventObj = { diff --git a/src/locales/en-AC.yaml b/src/locales/en-AC.yaml index b8c2676..b018f5b 100644 --- a/src/locales/en-AC.yaml +++ b/src/locales/en-AC.yaml @@ -49,3 +49,11 @@ AN ERROR OCCURRED WHILE RENDERING THE REGULAR EXPRESSION. "Retry": | RETRY +"Enter regular expression to display": | + ENTER REGULAR EXPRESSION TO DISPLAY +"Display": | + DISPLAY +"JavaScript": | + JAVASCRIPT +"PCRE": | + PCRE diff --git a/src/locales/en.yaml b/src/locales/en.yaml index 129f0a9..d8b1ab9 100644 --- a/src/locales/en.yaml +++ b/src/locales/en.yaml @@ -49,3 +49,11 @@ An error occurred while rendering the regular expression. "Retry": | Retry +"Enter regular expression to display": | + Enter regular expression to display +"Display": | + Display +"JavaScript": | + JavaScript +"PCRE": | + PCRE