Open satti-hari-krishna-reddy opened 6 months ago
Totals | |
---|---|
Change from base Build 7484346259: | -0.2% |
Covered Lines: | 1380 |
Relevant Lines: | 1398 |
@sushain97 , could you please review my pull request?
This looks reasonable at first glance but I'll take a closer look tomorrow. I may have been wrong about the cleanest way to do this since I haven't looked at the code in a while. I appreciate the detailed PR description.
@sushain97
i moved swapLangs
from src/components/translator/LanguageSelector.tsx
to the src/components/translator/Translator.tsx
and The swapping of languages and text is functioning as expected.
However, this change has caused some issues in LanguageSelector.test.tsx
. I made some adjustments to the test file to make it pass, but I think it might not be the optimal solution. Could you please take a look and help me on how to update the test accordingly?
fixes #469
Description :
This pull request addresses the issue where switching languages doesn't copy already provided input and output. With the modified changes now when the languages are swapped the new input is our already provided output.
before :
https://beta.apertium.org/index.eng.html#?dir=eng-spa&q=Dog
tohttps://beta.apertium.org/index.eng.html#?dir=spa-eng&q=Dog
After :
https://beta.apertium.org/index.eng.html#?dir=eng-spa&q=Dog
tohttps://beta.apertium.org/index.eng.html#?dir=spa-eng&q=Perro
Changes Made : -Lifted state from the child component
TextTranslationForm
to the parent componentTranslator
, passing the state and its corresponding setter functions as props and wrappedsetSrcText
andsetTgtText
in the functionswapLangText
to swap the text and passed it toLanguageSelector
as a prop. Included that function inswapLangs
function to call it whenever it is executed.-Modified
TextTranslationForm.test
to accommodate the new changes made toTextTranslationForm
. InLanguageSelector.test
, checked whetherswapLangText
is actually getting called or not.