Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
fix: fix ui language dropdown not being shown without also having ski…
Browse files Browse the repository at this point in the history
…pped sentences (#566)
  • Loading branch information
MichaelKohler authored Nov 25, 2021
1 parent 390bc6b commit 767cdec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
5 changes: 5 additions & 0 deletions web/src/components/profile/settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ test('should render title', async () => {
expect(screen.getByText('Settings')).toBeTruthy();
});

test('should render ui language section', async () => {
await renderWithLocalization(<Settings />);
expect(screen.getByText('Interface Language')).toBeTruthy();
});

test('should render error message', async () => {
(redux.useSelector as jest.Mock).mockImplementation(() => ({
showErrorMessage: true,
Expand Down
28 changes: 13 additions & 15 deletions web/src/components/profile/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export default function Settings() {
dispatch(resetSkippedSentences());
};

if (!skippedSentences || skippedSentences.length === 0) {
return null;
}

const onLanguageSelect = (locale: string) => {
history.push(`/${locale}/profile`);
};
Expand Down Expand Up @@ -77,17 +73,19 @@ export default function Settings() {
)}
</section>

<section className="settings-section">
<Localized id="sc-settings-reset-skipped">
<h3></h3>
</Localized>
<Localized id="sc-settings-skipped-decription">
<p></p>
</Localized>
<button className="standalone" onClick={resetSkipped}>
<Localized id="sc-settings-show-all-button" />
</button>
</section>
{skippedSentences && skippedSentences.length > 0 && (
<section className="settings-section">
<Localized id="sc-settings-reset-skipped">
<h3></h3>
</Localized>
<Localized id="sc-settings-skipped-decription">
<p></p>
</Localized>
<button className="standalone" onClick={resetSkipped}>
<Localized id="sc-settings-show-all-button" />
</button>
</section>
)}
</section>
</section>
);
Expand Down

0 comments on commit 767cdec

Please sign in to comment.